Mail Archives: djgpp-workers/2000/10/26/20:13:02
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 -