Gary Turner wrote:

>Drew Cohan wrote:

>>Using a bash shell script (/bin/sh), I need to know how to check to see
>>if certain files exist in a directory, as in, "Are there any jpegs in
>>this directory?".
<snip>
>
>Try 
>
>       ls *.jpg > /dev/null 2>&1       # tested command--output is
>                                                                                      
> # superfluous
>       if 
>               [ $? eq 0 ]                 # did last command succeed?
           ^^
        Ack! Make that "-eq"  Sorry about that.

>                       then echo "yes"         # shout hooray
>               else echo "no"                  # tears in your beer
>       fi
>--
>gt       [EMAIL PROTECTED]
>It ain't so much what you don't know that gets you in trouble---
>it's what you do know that ain't so.--unk

--
gt                         [EMAIL PROTECTED]
  Nielsen's First Law of Computer Manuals:
People don't read documentation voluntarily.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to