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