Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] my next stupid question


On Tue, Jul 03, 2001 at 02:33:19PM +1000, Jeff Waugh wrote:

> <quote who="Alister Waller">
> 
> > for i in `ls *.TXT`
> > do
> >  cat $i >> newfilename
> >  mv $i /tmp
> > done
> 
> Why cat? cp $i newfilename would do pretty well.

No it wouldn't.  Note the `>>'.

> > Now, if there are no *.TXT files then I get an error sent back to the owner
> > of the crontab file.

Try this:

  cat *.TXT >> newfilename 2>/dev/null
  mv *.TXT /tmp 2>/dev/null

Or even:

    (cat *.TXT >> newfilename && mv *.TXT /tmp) 2>/dev/null

Note that this will create `newfilename' even if there are no files
matching `*.TXT'.


Cheers,

John
-- 
whois !JC774-AU@xxxxxxxxxxxxxxx