[ILUG] ls behaviour

Padraig Brady padraig at antefacto.com
Mon Jan 28 11:59:48 GMT 2002


Gavin McCullagh wrote:

> 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


nullglob? (man bash)

Padraig.






More information about the ILUG mailing list