Michael Heironimus <[EMAIL PROTECTED]> wrote:
> 
> There is a way that looks slightly better, but it's still ugly because
> it relies on bash-specific options. Something like this should do it.
> 
> #! /bin/bash
> # Make globs that don't match expand to null string
> shopt -s nullglob
> if [ -n "$(echo /path/to/*.jpg)" ] ; then
>        # Do stuff because .jpg files exist
> fi

Here's how you can do it in a POSIX shell:

set -- /path/to/*.jpg
if [ -e "$1" ]; then
        # Do stuff because .jpg files exist
fi
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


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

Reply via email to