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


On Fri, Jul 28, 2000 at 09:30:13AM -0700, 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.

...which is what I'd expect.

I tried this on a couple of machines and the behavior is inconsistent.
Some print "0 isn't be 1" (sic) and some print nothing.

I would consider the triggering of the for-loop when there are no
arguments supplied to the shell script to be a bug.

cgf

--
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]