- To: Slug <slug@xxxxxxxxxxx>
- Subject: Re: [SLUG] my next stupid question
- From: Malcolm Tredinnick <malcolm@xxxxxxxxxxxxxxxxx>
- Date: Tue Jul 3 14:47:01 2001
- User-agent: Mutt/1.2.5i
On Tue, Jul 03, 2001 at 02:23:44PM +1000, Alister Waller wrote:
> another stupid question.
No such thing. :-)
> I am running a script from a cronjob. part of the script is a for loop. see
> below:
>
> for i in `ls *.TXT`
> do
> cat $i >> newfilename
> mv $i /tmp
> done
>
> Now, if there are no *.TXT files then I get an error sent back to the owner
> of the crontab file.
A fairly common idiom for this is:
fileList=`echo *.TXT`
if [ "$fileList" != '*' ]; then
...(insert other stuff here)
fi
That should do what you want.
Cheers,
Malcolm
--
Monday is an awful way to spend 1/7th of your life.