delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/02/14/10:12:46

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <200002141431.OAA14601@cav.logica.co.uk>
Date: Mon, 14 Feb 2000 14:31:23 GMT
To: bug-bash AT prep DOT ai DOT mit DOT edu
CC: cygwin AT sourceware DOT cygnus DOT com
From: fieldhouse AT logica DOT com (Dirk Fieldhouse)
Subject: bash - $@ vs shift inconsistent
X-Mailer: Mozilla/4.0 (Windows 95;US) Opera 3.62 [en]

I'm not sure that this is a specific CYGWIN issue, but I don't have access to a bash on a machine that allows spaces in filenames (surely the underscore character was invented to avoid these ...)

In bash 2.01.1 (b20.1/W95B), the following sequences which should have identical behaviour do not:

#!/bin/bash
for arg in "$@" ; do 
    echo "$arg" # splits "arg with spaces" into 3 args
    done

#!/bin/bash
while [ "$1" ] ; do 
    echo "$1"  # maintains "arg with spaces" as one argument
    shift
    done

I haven't tested these against ash, nor with the latest bash release (2.03?), and I would be delighted to hear that this is a historical problem.

I am sure that the second behaviour is correct, especially given the bash manual's description of $@.


-- 
Dirk Fieldhouse                 Logica UK Limited
fieldhouse AT logica DOT com           75 Hampstead Road
c=gb;a=attmail;p=logica;        London NW1 2PL
o=LOGICA;ou1=UK;s=fieldhouse    UK
+44 (20) 7637 9111
- not speaking for Logica

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019