[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

shell script removing log files.



This command in a shell script removes unwanted log files.

for i in $( echo *.Log ); do 
  /bin/rm $i; 
  echo "Removed $i." 
done

In the edge case of no matching files, rm complains.
/bin/rm: cannot remove `*.Log': No such file or directory

If echo is replaced with ls, it complains when there 
is no match.

Does anyone have a tidy solution for this task?

Thanks,                   ... Peter E.



-- 
123456789 123456789 123456789 123456789 123456789 123456789 123456789 12
Tel +1 360 639 0202   http://carnot.yi.org/   Bcc: peter at easthope. ca


Reply to: