Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-15 Thread Eric Blake
Brian Wilson ds.net> writes: > > The pipe is what spawns the sub shell. In Unix the last process runs in your > current shell. In Linux the first process of the pipe runs in the current > shell. The difference is that when the while statement (which is run in the > sub shell) finishes the

RE: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-15 Thread Brian Wilson
=== -- Original Message --- From: "Damo, David" To: "Damo, David" , "cygwin@cygwin.com" Sent: Thu, 14 Jan 2010 18:23:28 -0500 Subject: RE: Can't set variables in a while loop that is passed to the rest of the script. > Hi, > > I have fixed

Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-15 Thread Mark J. Reed
On Friday, January 15, 2010, Thomas Wolff wrote: > As was responded before, this isn't supposed to work in a pipe. Not in ksh > either, I think, No, it works in real ksh. If the last command in a pipeline is a builtin, it is run in the current shell. $ unset foo bar $ echo ${foo=hiya} | read

Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-15 Thread Thomas Wolff
Eric Blake wrote: According to Damo, David on 1/14/2010 3:39 PM: Hi, I had a script that worked on UNIX, but on Cygwin it does not work. When I set a variable in a while loop I can't use it after the loop. However, this worked in UNIX. Any ideas why? Yes. ksh vs. bash. http://tis

Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-14 Thread Eric Blake
According to Damo, David on 1/14/2010 3:39 PM: > Hi, > > I had a script that worked on UNIX, but on Cygwin it does not work. When I > set a variable in a while loop I can't use it after the loop. However, this > worked in UNIX. Any ideas why? Yes. ksh vs. bash. http://tiswww.case.edu/php/chet

Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-14 Thread Matthias Andree
Am 15.01.2010, 00:40 Uhr, schrieb Jeremy Bopp : On 1/14/2010 5:23 PM, Damo, David wrote: Hi, I have fixed the problem. It seems in cygwin it spawns a subshell even under bash. I used a for loop instead and everything worked nicely. for line in `sed 's/\$/^/g' $propfile` do nvpair=$

Re: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-14 Thread Jeremy Bopp
On 1/14/2010 5:23 PM, Damo, David wrote: > Hi, > > I have fixed the problem. It seems in cygwin it spawns a subshell even under > bash. I used a for loop instead and everything worked nicely. > > for line in `sed 's/\$/^/g' $propfile` > do > nvpair=$(echo $line | awk -F"=" '{print $1,$2}')

RE: Can't set variables in a while loop that is passed to the rest of the script.

2010-01-14 Thread Damo, David
Hi, I have fixed the problem. It seems in cygwin it spawns a subshell even under bash. I used a for loop instead and everything worked nicely. for line in `sed 's/\$/^/g' $propfile` do nvpair=$(echo $line | awk -F"=" '{print $1,$2}') set -- $nvpair if [ ! "$1" = "" ]; th