Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Subshells and parameters
- X-seq: zsh-users 10263
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Subshells and parameters
- Date: Fri, 12 May 2006 22:05:23 -0400
- Cancel-lock: sha1:xzCGYqHUd0G5EdcVYpH6kP1YHpA=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <lt8xp8sko1.fsf@xxxxxxxxxxxxxxxxxx> <20060511160123.29080117.pws@xxxxxxx> <20060512091722.GO4116@xxxxxxxxxxxxxxxxxxx> <87wtcr30nd.fsf@xxxxxxxxxx> <20060512230922.GA871@xxxxxxxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Vincent Lefevre <vincent@xxxxxxxxxx> writes:
> On 2006-05-12 08:09:26 -0400, Lloyd Zusman wrote:
>> So how can we get the process ID of any given subshell?
>
> dixsept:~> cat > getpid.c
> #include <stdio.h>
> #include <unistd.h>
> int main(void)
> {
> printf("%d\n", (int) getppid());
> return 0;
> }
> dixsept:~> gcc -Wall -O2 getpid.c -o getpid
> dixsept:~> echo $$; ./getpid
> 13372
> 13372
> dixsept:~> (echo $$; ./getpid)
> 13372
> 14153
> dixsept:~> (stat +link /proc/self; ./getpid)
> 14168
> 14168
>
> Note: as Peter said, /proc is specific to Linux.
Thanks. However, just as in my original message in the other thread,
I'm wondering if there's a solution that doesn't require a separate
executable. In other words, is it possible to get a subshell's pid in a
zsh-only manner, without using anything like the "stat" executable nor
the "getpid" utility described above?
Thanks.
--
Lloyd Zusman
ljz@xxxxxxxxxx
God bless you.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author