delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/14/10:30:05

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Thu, 14 Feb 2002 17:29:05 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Tim Van Holder <tim DOT van DOT holder AT pandora DOT be>
cc: djgpp-workers AT delorie DOT com
Subject: Re: Some small bash issues
In-Reply-To: <1013690570.30677.90.camel@bender.falconsoft.be>
Message-ID: <Pine.SUN.3.91.1020214172635.1382B-100000@is>
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 14 Feb 2002, Tim Van Holder wrote:

> [tim AT bender] /home/tim>cat >fooscript <<\EOF
> More>#! /bin/sh
> More>echo $foo
> More>EOF
> [tim AT bender] /home/tim>foo=bar ./fooscript 
> bar
> [tim AT bender] /home/tim>echo $foo
> 
> [tim AT bender] /home/tim>cat >fooscript <<\EOF
> More>#! /usr/bin/perl5
> More>print $ENV{"foo"} . "\n";
> More>EOF
> [tim AT bender] /home/tim>foo=bar ./fooscript 
> bar
> [tim AT bender] /home/tim>foo=bar perl -e 'print $ENV{"foo"} . "\n";'
> bar
> [tim AT bender] /home/tim>echo $foo
> 
> [tim AT bender] /home/tim>foo=bar perl -e 'print $ENV{"foo"} . "\n";'
> bar
> 
> So running perl DOES set foo; running echo doesn't.

Yes, but that's a different issue, I think: what I was talking about is 
whether foo=bar is in effect for the duration of the single command after 
"foo=bar".  You are talking, so it seems, about whether foo=bar stays in 
effect _after_ that command exits.  I don't expect the latter to happen 
in a shell, but as for Perl, I don't know enough about its semantics to 
judge.

- Raw text -


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