Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3D7DB9DF.1020600@rousselot.org> Date: Tue, 10 Sep 2002 11:22:39 +0200 From: Philippe Rousselot User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020513 Netscape/7.0b1 X-Accept-Language: fr-fr, en-us, en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: problem with sh script Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I have the following script. it works fine under Linux. but blocks under Cygwin I get this error message: /usr/local/bin/thumbnail: 25:Syntax error: word unexpected (expecting ")") line 25 is array=('' '' '') thanks in advance for your help ~~~~~~~~~~~~~~~~~~~~~~ #!/bin/sh # ~~~~~~~~ original credit ~~~~~~~~~~~~~ #vim: set sw=4 ts=4 et: # wirtten by katja socher # and guido socher # ~~~~~~ end original credit ~~~~~~~~~~~ # I found the file at http://linuxfocus.org/English/July2001/article211.shtml # the file has been heavily modified by myself # to be able to create w3 compliant html page # this is my first bash script, don't hesitate to email me any error or improvement # Philippe Rousselot Aug. 2002, EMail: linux at rousselot dot org ver="1.0" one=1 number=1 extension=".html" page_numb=1 ; j=0 array=('' '' '') help() { cat < $filename << EOF "$title" EOF } footer() { cat >> $filename << EOF
$title2

Valid HTML 4.01!

EOF } while [ -n "$1" ]; do case $1 in -h) help;shift 1;; --) break;; -W) width=$2; break;; -H) echo "wrong argument. It should be -W";exit 1;; -N) echo "wrong argument. It should be -W";exit 1;; -n) echo "wrong argument. It should be -W";exit 1;; -*) echo "error: no such option $1. -h for help";exit 1;; *) break;; esac done while [ -n "$3" ]; do case $3 in -h) help;shift 1;; --) break;; -W) echo "wrong argument. It should be -H";exit 1;; -H) height=$4 ;break;; -N) echo "wrong argument. It should be -H";exit 1;; -n) echo "wrong argument. It should be -H";exit 1;; -*) echo "error: no such option $1. -h for help";exit 1;; *) break;; esac done while [ -n "$5" ]; do case $5 in -h) help;shift 1;; --) break;; -W) echo "wrong argument. It should be -N";exit 1;; -H) echo "wrong argument. It should be -N";exit 1;; -N) name=$6 ; break;; -n) echo "wrong argument. It should be -N";exit 1;; -*) echo "error: no such option $1. -h for help";exit 1;; *) break;; esac done while [ -n "$7" ]; do case $7 in -h) help;shift 1;; --) break;; -W) echo "wrong argument. It should be -n";exit 1;; -H) echo "wrong argument. It should be -n";exit 1;; -N) echo "wrong argument. It should be -n";exit 1;; -n) quota=$8 ; break;; -*) echo "error: no such option $1. -h for help";exit 1;; *) break;; esac done dirname_image=`dirname "$9"` th="thumbnails" thumbnail_dir="$dirname_image/$th" page_numb=`printf "%.2d" $page_numb` ; filename="$dirname_image/$name$page_numb$extension"; title="$name$page_numb$extension"; mkdir "$thumbnail_dir" if [ -z "$9" ];then error "No image specified, -h for help" 1 fi # process each image i=0; header; shift 8 for image in $* ; do echo "$image" if [ ! -r "$image" ]; then echo "ERROR: can not read $image\n" else i=`expr $i + 1` bn=`basename "$image"` array[j]=$bn j=`expr $j + 1` thumbnail="$thumbnail_dir/t_$bn" convert -geometry "${width}x$height" "$image" "$thumbnail" cat >> $filename << EOF [$bn] EOF modulo=`expr $i % 3` if [ "$modulo" = "0" ]; then cat >> $filename << EOF ${array[0]} ${array[1]} ${array[2]}


EOF j=0 array=('' '' '') fi modulo=`expr $i % $quota` if [ "$modulo" = "0" ]; then page_numb=`expr $page_numb + 1`; page_numb=`printf "%.2d" $page_numb` ; filename2="$dirname_image/$name$page_numb$extension"; title2="$name$page_numb$extension"; if [ "$number" -ne "$one" ]; then echo "Back" >> $filename ; fi number=`expr $number + 1` i=0 footer; filename=$filename2 title=$title2 header; fi fi done footer #end script~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Philippe Rousselot. utilisateur GNU/Linux #275608 ~~~~~~~~~~~~~ Any similarities to real life is completely fictitious. Nor trees or animals were harmed in the composition of this email message. However, a number of electrons were moderately inconvenienced. ~~~~~~~~~~~~~ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/