This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: shell script bug


Noel,

I just ran your script with ksh on Solaris and bash on Cygwin:

	./asdf.sh a b '1 2'

and got the same output for both.  I'm using the 1.1.2 net Cygwin and
bash 2.04.0(1)-release.

Noel Yap wrote:
> 
> I have the following script asdf.sh:
> #!/bin/sh
> 
> if [ $# = 1 ]
> then
>   for v in "$@"
>   do
>     echo $# should be 1
>     echo "$v"
>   done
> else
>   for v in "$@"
>   do
>     echo $# isn\'t be 1
>     ./asdf.sh "$v"
>   done
> fi
> 
> Under bash, the output of the script is:
> 5 isn't 1
> 5 isn't 1
> 5 isn't 1
> 5 isn't 1
> 5 isn't 1
> 
> Under sh, there is no output.
> 
> The output (verified on Solaris) should be:
> 5 isn't 1
> 1 should be 1
> a b
> 5 isn't 1
> 1 should be 1
> c d
> 5 isn't 1
> 1 should be 1
> e f
> 5 isn't 1
> 1 should be 1
> g
> 5 isn't 1
> 1 should be 1
> h
> 
> My CYGWIN is set to "export ntea" (if that matters).
> 
> Noel
> 
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan@veritas.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]