[ILUG] ls behaviour

Gavin McCullagh gavin at fiachra.ucd.ie
Mon Jan 28 11:36:57 GMT 2002


Hi all,

if I do 

ls lattice_*.dat

In the normal way I get back everything which matches that pattern.  Great.
However, on the occasion that nothing matches it why do I get a full listing of
the directory?  Why don't I get an empty list or file not found or
something?

it's particularly irritating when you do something like

for i in `ls lattice_*.dat`
do
rm $i
done

and everything else gets deleted if there isn't a match of lattice_*.dat

It just doesn't seem very logical to me.

Gavin






More information about the ILUG mailing list