bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: piped functions cannot set variables


From: Paul Jarc
Subject: Re: piped functions cannot set variables
Date: Thu, 19 Dec 2002 12:07:25 -0500
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

"Andrew Robb" <address@hidden> wrote:
> The shell function is not running in a separate process,

It is.  You can observe this with a system call trace.

> $$ gives the same value in the shell function as the calling
> process.

$$ also gives the same value inside an explicit subshell like
"(command)"; would you claim that no extra process is created then?
$$ doesn't mean what you think it means in these situations.  It is
initialized with getpid() when the shell first starts, and is not
reset for subprocesses.

You might make a feature request, saying that bash *shouldn't* fork a
subprocess when the pipeline element is a shell function.  But that is
indeed what it does currently.


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]