sysy-data/init.sh

37 lines
735 B
Bash
Raw Normal View History

2024-01-09 19:48:14 +08:00
#!/bin/bash
# 编写一个脚本,实现以下功能:
# 把当前目录下后缀为.in的文件放入文件夹in中
# 把当前目录下后缀为.out的文件放入文件夹out中
# 把当前目录下后缀为.sy的文件放入文件夹sy中
2024-01-09 20:01:01 +08:00
cd $1
2024-01-09 19:48:14 +08:00
# 如果文件夹不存在则创建
if [ ! -d "in" ]; then
mkdir in
fi
if [ ! -d "out" ]; then
mkdir out
fi
if [ ! -d "sy" ]; then
mkdir sy
fi
# 把当前目录下后缀为.in的文件放入文件夹in中
for file in `ls *.in`
do
mv $file in
done
# 把当前目录下后缀为.out的文件放入文件夹out中
for file in `ls *.out`
do
mv $file out
done
# 把当前目录下后缀为.sy的文件放入文件夹sy中
for file in `ls *.sy`
do
mv $file sy
done