Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exec -l
- X-seq: zsh-workers 23353
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: exec -l
- Date: Sun, 29 Apr 2007 19:48:53 -0700
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=first1; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=N7wvGFXdDcdMer69/GFjccF0sdJYPgd/4Sp1fG6vqZfXzrkPOOzt40wQpt77iYJ82VMyeP7hXhtJoAXgxAJd94HJvMBAwxqFvTax7GnwONmRumtAexXD/7ETXGH8L2lxyJKxk51VAanz/SMGgkTTkmtFYgiFn2p6fmpKBFuDj6E=;
- In-reply-to: <pdy98830624081fc25aec5f807f@[192.168.1.2]>
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <pdy98830624081fc25aec5f807f@[192.168.1.2]>
On 2007-04-29 at 17:52 -0700, Dave Yost wrote:
> Why does zsh not have "exec -l" a la bash?
Because zsh had already introduced its own non-standard way to do the
same thing before bash added its own non-standard extension? And
nobody's pushed to copy bash's behaviour? And ksh has yet another way.
So there's no portable method and nobody's yet contributed code to zsh
to copy the interface provided by other shells.
The Single Unix Specification v3 doesn't include any flags for exec.
(Look in the XCU section). Zsh does not provide any flags.
In zsh, you can put a "-" at the start of any external command by using
the "-" builtin command. It's the first builtin listed in
zshbuiltins.1. So, you'd do:
exec - cmd
so that you exec cmd with argv[0] being "-cmd". Or just "- cmd" to run
it as a child process.
Alternatively, zsh lets you specify _any_ string as argv[0] for a new
command by ensuring that the variable ARGV0 is set in the environment
when you run it. So, for instance, you can do:
ARGV0=-sh exec zsh
to exec zsh with argv[0] set to "-sh", such that zsh will emulate a
POSIX "sh" more closely and do so as a login shell. This is what in ksh
would be "exec -a -sh zsh".
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author