Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] if [[ -e *.TXT ]] ; then


<quote who="Alister Waller">

> how do I check that a file with a particular extension exists in a directory
> in a shell script.
> 
> eg:
> 
> if [[ -e *.TXT ]] ; then

How about...

if [ ! -z $(/bin/ls -1 | grep -c .TXT$) ]; then echo pants; fi

- Jeff

-- 
   She said she loved my mind, though by most accounts I had already lost   
                                    it.