Re: Assign variable to variable ? Why doesn't this work?
From: Icarus Sparry (usenet_at_icarus.freeuk.com)
Date: 01/28/04
- Next message: Icarus Sparry: "Re: Can sed solve the following question?"
- Previous message: William Park: "Re: Can sed solve the following question?"
- In reply to:(deleted message) Mark: "Assign variable to variable ? Why doesn't this work?"
- Next in thread: Chris Mattern: "Re: Assign variable to variable ? Why doesn't this work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jan 2004 04:28:51 GMT
On Tue, 27 Jan 2004 11:34:49 -0500, Mark wrote:
> I'm using bash. Specifically, the last echo returns nothing. What am I
> missing? If I do this manually (assign variable to another variable) it
> works.
>
>
> ps -ef |grep -i searchtext|grep -i $remote |while read a b c d e f g h i j
> do
> echo $b $j
> pid=$b
> remotename=$j
> done
>
> echo $pid $remotename
ps -ef |grep -i searchtext|grep -i $remote | {
while read a b c d e f g h i j
do
echo $b $j
pid=$b
remotename=$j
done
echo $pid $remotename
}
As others have said, the problem is subshells. With a couple of extra
characters you can get the subshells created as you wish.
- Next message: Icarus Sparry: "Re: Can sed solve the following question?"
- Previous message: William Park: "Re: Can sed solve the following question?"
- In reply to:(deleted message) Mark: "Assign variable to variable ? Why doesn't this work?"
- Next in thread: Chris Mattern: "Re: Assign variable to variable ? Why doesn't this work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]