Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: should $! give the pid of subshell?
- X-seq: zsh-users 14612
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh list <zsh-users@xxxxxxx>
- Subject: Re: should $! give the pid of subshell?
- Date: Wed, 25 Nov 2009 17:48:52 +0000
- In-reply-to: <19213.26295.345572.732238@xxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <19213.26295.345572.732238@xxxxxxxxxxxxxxxxxx>
Greg Klanderman wrote:
> If I do
>
> % ( cd directory && command ) &
> % echo $!
>
> should I get the pid of 'command' or of the subshell?
The latter, but actually they're the same here. zsh "exec"s the final
command since it notices the subshell isn't needed any more so there's
no point in forking. All you're guaranteed is that the stuff in ( ) is
executed as part of a subshell, you're not guaranteed the shell forks
again to run "command".
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author