Gentoo Archives: gentoo-user

From: Michael Sullivan <michael@××××××××××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: [gentoo-user] OT - Question about new bash
Date: Sun, 29 Jan 2006 17:49:19
I wrote a script a long time ago for resizing pictures uploaded to a
certain directory on my server box.  The script was supposed to check to
see if any JPG files in the directory had not been resized, and if they
hadn't, it was supposed to resize them.  It did some other stuff, but
that was the important thing.  It worked fine until the recent bash
upgrade and now it gives me an error.  Here is the script:

michael@bullet ~ $ cat system/resizepics
cd /home/michael/unfiledPics

if [ ! -d current ]; then
   mkdir -p current/mini

if [ ! `ls -l | wc -l` -le 2 ]; then
   for x in *.JPG; do
      if [ ! -e current/$x ]; then
         convert "$x" -thumbnail 200x200 -verbose current/mini/mini-"$x"
         convert "$x" -thumbnail 640x480 -verbose current/"$x";

if [ `ls -l | wc -l` -ge 12 ]; then
   today=`date '+%m%d%y'`
   mv current $today
   mv $today /home/michael/webspace/html/camera
   mkdir -p /home/michael/unfiledPics/current/mini
   rm /home/michael/unfiledPics/*.JPG


As I said, before the bash upgrade this worked perfectly.  Now, when I
try to run it, I get this:

michael@bullet ~ $ system/resizepics
system/resizepics: line 11: [: too many arguments
system/resizepics: line 11: [: too many arguments

The error is printed twice because there are two .JPG being checked, but
I'm not sure why the error is occurring in the first place.  Line 11

if [ ! -e current/$x ]; then

This used to mean "if a file named "current/<whatever $x is>" does not
exist, then execute the following block", but it keeps tripping on this
line.  Was the -e switch deprecated or something?  What should it be?
If it matters, my /bin/bash version is

michael@bullet ~ $ bash --version
GNU bash, version 3.00.16(1)-release (i586-pc-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

Please help!

gentoo-user@g.o mailing list


Subject Author
Re: [gentoo-user] OT - Question about new bash fire-eyes <sgtphou@×××××××××.org>
Re: [gentoo-user] OT - Question about new bash znx <znxster@×××××.com>
Re: [gentoo-user] OT - Question about new bash Alexander Skwar <listen@×××××××××××××××.name>