zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@sunsite.dk
Subject: Re: exec -l
Date: Sun, 29 Apr 2007 19:48:53 -0700	[thread overview]
Message-ID: <20070430024853.GB65832@redoubt.spodhuis.org> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2007-04-30  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30  0:52 Dave Yost
2007-04-30  2:33 ` Geoff Wing
2007-04-30  2:48 ` Phil Pennock [this message]
2007-04-30  4:39 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070430024853.GB65832@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).