Hi, "Gerald V. Livingston II" <[EMAIL PROTECTED]> writes:
> Colin Watson said: > >> On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote: >>> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg"; >>> done fi >> >> That -e test looks dreadful ... surely it'll usually expand to lots of >> arguments which will confuse [, or perhaps to an empty string >> (nullglob) >> which will also confuse test? >> >> -- >> Colin Watson >> [[EMAIL PROTECTED]] > > And I've bumped into this. How *DOES* one test for the existence of > ANY file with a given extension without getting a "too many arguments" > error when there are multiple files? > > I want "TRUE" if there is one or more zzz.jpg files in a directory, > "FALSE" if there are zero of them. Try list=`echo *.jpg` case $list in '*.jpg') echo "nothing to be done";; *) for i in $list; do mv $i `basename $i .jpg`.jpeg; done esac - Hari -- Raja R Harinath ------------------------------ [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]