Mail Archives: djgpp-workers/2000/10/25/22:33:59
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 -