delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/10/25/22:33:59

Message-Id: <4.3.1.0.20001025221409.00ad89b0@pop5.banet.net>
X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net
X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
Date: Wed, 25 Oct 2000 22:32:58 -0400
To: djgpp-workers AT delorie DOT com
From: "Peter J. Farley III" <pjfarley AT banet DOT net>
Subject: Re: Bash 2.04 beta 6a
Cc: "Mark E." <snowball3 AT bigfoot DOT com>
In-Reply-To: <39F4D6CB.20960.364B6C@localhost>
References: <4 DOT 3 DOT 1 DOT 0 DOT 20001023205604 DOT 00b0edf0 AT pop5 DOT banet DOT net>
<39F47A27 DOT 20049 DOT BA7D8C AT localhost>
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

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.
3.	The echo command just sees a blank, so it just outputs an empty 
line.

The reason that I needed to put in two escapes into the perl script 
will be evident from the output below.

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

---------testecho.sh---------------------------
#!/bin/sh
bash --version
echo #foo
echo \#foo
echo \\#foo
---------testecho.sh---------------------------

I ran this script under both bash versions that I have, 2.03(r0.6) and 
2.04.7(1).  Here is the transcript of the tests (with a few extra 
newlines removed between pure-dos commands like cd and move and copy):

---------test transcript-----------------------
M:\gnu>bash ./testecho.sh
GNU bash, version 2.04.7(1)-release (i386-pc-msdosdjgpp)
Copyright 1999 Free Software Foundation, Inc.

#foo
\#foo

M:\gnu>cd\bin
M:\bin>move bash.exe bash2047.exe
M:\BIN\bash.exe => M:\BIN\bash2047.exe [ok]
M:\bin>copy bash2036.exe bash.exe
         1 file(s) copied
M:\bin>cd \gnu
M:\gnu>bash ./testecho.sh
GNU bash, version 2.03.0(1)-release (i386-pc-msdosdjgpp) r0.6
Copyright 1998 Free Software Foundation, Inc.

#foo
\#foo

M:\gnu>
---------test transcript-----------------------

Note that in both versions, a single escape ("\#") produces the result 
that this perl test wants to see.  I needed to put two escapes into the 
perl test script because perl itself removes one level of escape, than 
then bash removes the second one.

I hope this helps.  Please let me know if you all think this is bash or 
echo or what.  And thank you for you patience with my ignorance and 
sloppy investigation techniques.

Peter
---------------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org OR
                      pjfarley AT banet DOT net)

- Raw text -


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