#!/bin/bash # 编写一个脚本,实现以下功能: # 把当前目录下后缀为.in的文件放入文件夹in中 # 把当前目录下后缀为.out的文件放入文件夹out中 # 把当前目录下后缀为.sy的文件放入文件夹sy中 # 如果文件夹不存在则创建 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