delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/10/26/20:13:02

Message-Id: <4.3.1.0.20001026195212.00b2d270@pop5.banet.net>
X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net
X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
Date: Thu, 26 Oct 2000 20:13:22 -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: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, snowball3 AT bigfoot DOT com
In-Reply-To: <2110-Thu26Oct2000185038+0200-eliz@is.elta.co.il>
References: <4 DOT 3 DOT 1 DOT 0 DOT 20001025221409 DOT 00ad89b0 AT pop5 DOT banet DOT net>
<4 DOT 3 DOT 1 DOT 0 DOT 20001023205604 DOT 00b0edf0 AT pop5 DOT banet DOT net>
<39F47A27 DOT 20049 DOT BA7D8C AT localhost>
<4 DOT 3 DOT 1 DOT 0 DOT 20001025221409 DOT 00ad89b0 AT pop5 DOT banet DOT net>
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

At 06:50 PM 10/26/00 +0200, Eli Zaretskii wrote:
 >> Date: Wed, 25 Oct 2000 22:32:58 -0400
 >> From: "Peter J. Farley III" <pjfarley AT banet DOT net>
 >>
 >> 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.
 >
 >If Perl passes the command to Bash, this is expected behavior.  What 
I
 >don't understand is how does this work on Unix.

Laszlo Molnar has pointed me to a djgpp-specific wrapper function for 
pipes in the perl implementation, and says that it just uses system() 
to invoke bash.  I will research this function and let you know what I 
find.

 >There's one subtlety here that you should be aware of (perhaps it 
even
 >explains why this works on Unix, but not in DJGPP).  Our `system'
 >invokes Bash like this:
 >
 >	bash temp-file
 >
 >where `temp-file' holds the entire command line.  I'm guessing that 
on
 >Unix, `system' calls Bash like this:
 >
 >        bash -c 'command line'
 >
 >It is possible that # is treated differently in a file and inside the
 >argument to -c.

Well, on the Linux I have available, using the "-c" option gave the 
same results as running it through a shell script.  Which is not to say 
that all *ix systems work that way.

BTW, single-quoting the argument to echo (echo '#foo') also resolves 
the problem, but as someone (I don't remember who at this point) 
already said to me on this subject, this "#" behavior may very well be 
what is being tested, so changing the test may or may not be the "right 
thing" to do.

I do wonder, does DJGPP's bash thinks it is being run interactively 
when invoked from system()?  That would invoke the "#" rule, for 
sure.  Maybe the shell needs to be told it is being run 
non-interactively?  Is this possible?  I'm thinking that when perl on 
*ix invokes the shell, the shell already knows he is not being run 
interactively, and so suspends or bypasses the "#" rule.

More later.  After tonight, I may be away from this problem for the 
weekend, my RL job has a big installation going on this weekend, and I 
may or may not get back to the list before next Tuesday or so.

Then again I may.  RL jobs have a lot of "hurry up and wait" associated 
with them.

Bye for now.
---------------------------------------------------------
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