www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/14/02:44:49

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Subject: Re: Some small bash issues
From: Tim Van Holder <tim DOT van DOT holder AT pandora DOT be>
To: djgpp-workers AT delorie DOT com
In-Reply-To: <3C6A8F2E.19324.1C1A9C@localhost>
References: <3C6A8F2E DOT 19324 DOT 1C1A9C AT localhost>
X-Mailer: Evolution/1.0.2
Date: 14 Feb 2002 08:40:40 +0100
Message-Id: <1013672451.28939.34.camel@bender.falconsoft.be>
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, 2002-02-13 at 22:07, Mark E. wrote:
> >  - readline not quite OK (Del, Ctl-Left, Ctl-Right, ... don't work)
> 
> set TERM=djgpp
> should do it.

Ah OK - thanks.

> >  - some issues with envvars:
> > 
> >       foo=bar echo $foo
> > 
> >    is supposed to print "bar", but doesn't.
> 
> I seem to remember answering this once before. The answer is that this is the 
> way Bash works:
> 
> Simple Command Expansion
> ------------------------
> 
>    When a simple command is executed, the shell performs the following
> expansions, assignments, and redirections, from left to right.
> 
>   1. The words that the parser has marked as variable assignments (those
>      preceding the command name) and redirections are saved for later
>      processing.
> 
> 
> In other words, "foo=bar" isn't peformed until after the command is executed.

Right.
Which explains why it works for

   foo=bar ./shell-script

because everything in the script is simply a 'new command'.

So the problem is that a Perl script isn't run that way on DJGPP.
On Unices,

  foo=bar ./perl-script

works fine (presumably, bash tries to process it as a shell script, sees
the #!, expands the envvar, and hands the script off to the system).
On DJGPP, bash runs the script without substituting the variable.

I'll see if the lack of ';' is deliberate (i.e. maybe "foo=bar;
./script" isn't portable); if not, I'll submit a patch to autoconf &
automake to use one.


- Raw text -


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