Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
From: Chris Faylor <cgf@cygnus.com>
Date: Fri, 28 Jul 2000 12:57:49 -0400
To: cygwin@sourceware.cygnus.com
Subject: Re: shell script bug
Message-ID: <20000728125749.A5152@cygnus.com>
Reply-To: cygwin@sources.redhat.com
Mail-Followup-To: cygwin@sourceware.cygnus.com
References: <20000728163013.15552.qmail@web1306.mail.yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2i
In-Reply-To: <20000728163013.15552.qmail@web1306.mail.yahoo.com>; from yap_noel@yahoo.com on Fri, Jul 28, 2000 at 09:30:13AM -0700

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

