From: Seebs on
On 2010-01-18, mop2 <invalid(a)mail.address> wrote:
> A subshell is not always an other kernel process:

Yes, it is.

However, it is a new process which remembers the value of $$ from the
parent shell and expands $$ to that rather than its own pid.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: mop2 on
On Mon, 18 Jan 2010 18:48:27 -0200, Seebs <usenet-nospam(a)seebs.net> wrote:

> On 2010-01-18, mop2 <invalid(a)mail.address> wrote:
>> A subshell is not always an other kernel process:
>
> Yes, it is.
>
> However, it is a new process which remembers the value of $$ from the
> parent shell and expands $$ to that rather than its own pid.
>
> -s


Seebs ,
thanks for the quick reply and correction to my previous wrong post.

Correcting myself in the shell:
$ while read;do printf "$REPLY\t\t";eval "$REPLY";done< a
eval echo $0 $$ $BASHPID -bash 1505 1505
{ eval echo $0 $$ $BASHPID;} -bash 1505 1505
(eval echo $0 $$ $BASHPID) -bash 1505 6229
cat< <(eval echo $0 $$ $BASHPID) -bash 1505 6231
echo `eval echo $0 $$ $BASHPID` -bash 1505 6232
echo $(eval echo $0 $$ $BASHPID) -bash 1505 6233
bash -c 'eval echo $0 $$ $BASHPID' bash 6234 6234
bash <<<'eval echo $0 $$ $BASHPID' bash 6235 6235
(eval echo $0 $$ $BASHPID;read -p read...<&2) -bash 1505 6236
read...


The confirmation, user root in another xterm, while "read" is waiting:
# pstree -p|tail -n3
|-xterm(4308)---bash(4309)-+-pstree(6347)
| `-tail(6348)
`-xterm(1489)---bash(1505)---bash(6236)


Really only {...} uses the same kernel process. Thanks.
From: Maxwell Lol on
Robert Latest <boblatest(a)yahoo.com> writes:

> $ cat | read h m ; echo $h $m | Let's pipe stdin through cat

s/cat |//
From: Robert Latest on
Maxwell Lol wrote:
> Robert Latest <boblatest(a)yahoo.com> writes:
>
>> $ cat | read h m ; echo $h $m | Let's pipe stdin through cat
>
> s/cat |//

You missed the point.

Everybody else, thanks for your input (much of which went clear over my
head).

robert
From: Randal L. Schwartz on
>>>>> "Robert" == Robert Latest <boblatest(a)yahoo.com> writes:

Robert> In short: Why doesn't 'read' assign any values to variables h and m
Robert> when stdin comes in from a pipe?

Different shell. Gotta fork to do a pipe.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: Mutt: unable to attach file
Next: Why NonZero Exit Status