On Sun, 14 Jun 1998 [EMAIL PROTECTED] wrote:
> cd /directory
> for file in *
> do
> if [ -f $file ] ; then
> echo -e "From - `date +%c`" >> Misc
> cat $file >> Misc
> rm -f $file
> echo "" > /tmp/.misc
> fi
> done
>
i think the main reason for the high cpu usage is the "for" statement ends
up with a truck load of arguments.. all of which are chewinig resources
before you even start doing anything...
I'd split it into too parts...
make a script for the do/done portion... say cat_and_rm
==== start of cat_and_rm ====
#! /bin/bash
echo -e "From - `date +%c`" >> Misc
cat $1 >> Misc
rm -f $1
echo "" > /tmp/.misc
==== end of cat_and_rm ====
and then use find for the remainder...
find /directory -maxdepth 1 -type f -exec cat_and_rm \{\} \;
and that should be it... :)
Hope that helps..
M.
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.