On Sat, Dec 07, 2002 at 01:45:45AM -0500, Travis Crump wrote:
> From the there has got to be a better way department:
> 
> ls /opt/images/*.jpg > /dev/null 2>&1 && echo there are jpegs

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

-- 
Michael Heironimus


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

Reply via email to