一.编写一个Shell脚本,实现如下功能: 1、从脚本参数获取到的目录名列表;

2024-11-28 18:26:58
推荐回答(1个)
回答1:

3.# !/bin/bash
cd $1
ls –a|grep ‘*.dat’
ls –a|grep ‘*.log’
mkdir DONE/
for files in *.dat
do
mv $datfile ${datfile%.dat}._donedat
cp -r ${datfile%.dat}._donedat DONE/${datfile%.dat}._donedat
done
for logfile in *.log
do
mv $ logfile ${ logfile %.log}._donelog
cp –r ${ logfile %.log}._donelog DONE/${datfile%.dat}._donelog
done