delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/08/06:48:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: <427DEE0E.6030603@hones.org.uk>
Date: Sun, 08 May 2005 11:46:38 +0100
From: Cliff Hones <cliff AT hones DOT org DOT uk>
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: base-files patch (atn: Eric Blake)
References: <032520051926 DOT 2104 DOT 424465D60002AFD30000083822058861720A050E040D0C079D0A AT comcast DOT net> <1492 DOT 192 DOT 168 DOT 0 DOT 12 DOT 1115538762 DOT squirrel AT mail DOT morrison DOT mine DOT nu>
In-Reply-To: <1492.192.168.0.12.1115538762.squirrel@mail.morrison.mine.nu>
X-IsSubscribed: yes

John Morrison wrote:
> On Fri, March 25, 2005 8:26 pm, Eric Blake said:
> 
>>True enough.  And that points out another bug - echo "$0" may fail if $0
>>starts with -, it should be echo -- "$0".  Isn't portable shell
>>programming fun?
> 
> Sorry that this has taken so long, but I'm just getting around to adding
> all the fixes emailed wrt /etc/profile.  I tried the above, and it broke
> so I checked the man pages,
> 
> <quote>
> `echo' writes each given STRING to standard output, with a space between
> each and a newline after the last one.  Synopsis:
> 
>      echo [OPTION]... [STRING]...
> 
>    The program accepts the following options.  Also see *Note Common
> options::.  Options must precede operands, and the normally-special
> argument `--' has no special meaning and is treated like any other
> STRING.
> </quote>
> 
> so, I'm afraid that echo -- "${0}" won't work.

I think echo "" "${0}" has the desired effect (apart from a leading space).

-- Cliff

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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