www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/10/26/07:15:10

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Thu, 26 Oct 2000 13:14:26 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: Bash 2.04 beta 6a
In-Reply-To: <4.3.1.0.20001025221409.00ad89b0@pop5.banet.net>
Message-ID: <Pine.LNX.4.10.10010261304100.16093-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 25 Oct 2000, Peter J. Farley III wrote:

> I have a pure bash test script that demonstrates the problem 
> now.  Based on the results below, I think this is what is happening in 
> the original perl test (with no escapes):
> 
> 1.	perl calls the bash shell with the command "echo #foo"
> 2.	Something about the "#" causes bash to ignore everything starting 
> with the "#" character.

This 'something' is easily understandable, I think: # starts comments, in
bash and most other Unix shells. So yes, "echo foo # bar" will only output
'foo', but not '# bar'.

I've seen people claim that this was incorrect behaviour of 'echo', which
should output everything you write after it verbatim, without *any*
alterations other than quotation, $VARIABLE expansions and redirection.
Csh, e.g., behaves that way:

acp3bf-broeker ~> echo foo # bar
foo # bar

But bash doesn't do it that way, not even in 'POSIXLY_CORRECT' mode. If
you want to echo a '#' sign after a whitespace, you have to quote it.

> I begin to suspect there may be a lexing error here, where bash thinks 
> the "#" is a comment character.  

No, that's documented standard behaviour of Bourne-style sh. '#' is a
comment character, in shell scripts. I suspect that Perl testsuite
fragment's goal was exactly that: to check which school the user's shell
is in.

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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