delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/04/10/16:45:44

Message-Id: <200004102123.RAA32685@qnx.com>
Subject: Re: Porting problems with Sh-utils (beta)
To: djgpp-workers AT delorie DOT com
Date: Mon, 10 Apr 2000 17:23:36 -0400 (EDT)
From: "Alain Magloire" <alain AT qnx DOT com>
In-Reply-To: <38F1FE56.2192.1342F3@localhost> from "Mark E." at Apr 10, 2000 04:16:22 PM
X-Mailer: ELM [version 2.5 PL0b1]
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

> 
> > What I think is happening is that the value of source is being lost after the
> > execution of the 1st process (that's `echo`). And since the script is invoked
> > next (the 2nd process to run), the "source" value is for some reason not
> > passed on which I think is a bug.
> > 

Sorry, I did not follow the thread(no email for a while)
so I maybe out of line.

> 
> Here are some curious items I came across:
> # source does not get set
> source='here is some text' echo $source
> 

Normal behaviour, $source was expanded already

> # source does get set
> source='here is some text' ; echo $source
> 

Normal behaviour source is set in the environment , but have you try these
# source='hello' ; sh -c 'echo $source'

# export source='hello' ; sh -c 'echo $source'
hello

different behaviours (note the export).

> # source does get set, and so does source2
> source='here is some text' source2='here is more more text'
> echo "$source"
> echo "$source2"
> 
> It would seem that multiple variable assignments are ok, but a variable 
> assignment followed by a non-variable assignment isn't.

Well that expected behaviour

# source='hello'  echo $source

$source was already expanded,  But If you try this

# cat echo_source
echo $source
# chmod +x echo_source
# source='hello' ./echo_source
hello

I do not know if this was helpfull, not seeing the original question
I shall go back to the shadow.

Note: the examples were done on my Solaris box with bash 2.02


-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on n'est toujours assis que sur son cul !!!

- Raw text -


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