Re: shell game
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 kk5st@sbcglobal.net
>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 kk5st@sbcglobal.net
Nielsen's First Law of Computer Manuals:
People don't read documentation voluntarily.
Reply to: