Zsh Mailing List Archive
Messages sorted by:
Additional arguments to "emulate -c"
- X-seq: zsh-workers 40978
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Additional arguments to "emulate -c"
- Date: Sat, 15 Apr 2017 21:09:34 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version; bh=ql1X9LFeMRxdl0KKA4odZTeQUhePco/qouyQXMYHTOY=; b=RqSs1JtSvDtwWmG/tIe1ZYl343iGiqgcpZIoLpd1AyAvvcuHTZkeqDGu3UPmK1k9Cv okuFq5BW9PTgmZbqpiZWNahpAmuabOD/9i1aRNsP+Th1l3I9VoFjQ0D3+CYtpoQdTd99 Ghh2Mqh3YcHRZ0AVIYhfpmx7JvQcPdPB5+1iHLwJDi2+KI1dr+du2k5CqACbQmnvzNBV yJ9byA2+eHeezouRzPzDCBTEVbtr7P6/uV1zqsBORqquJNeJZ83MsVVeKRea3ZH0ja5W 2OMdbMP3CVShxs5WbH3tE0sgjuphELhG4zgzeT+n3dnTRfb+vNlrE+jQAIEhQMbPwm8O lu0A==
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
As presently implemented,
emulate zsh -c first rest
will produce the error "emulate: unknown argument rest".
The intention here was that the -c option would behave akin to -c in the
options at shell startup that is in
zsh -c first rest
only "first" is interpreted as a command, and "rest" (etc.) becomes $@
for the top-level shell.
However, there doesn't seem to be any other reason for "emulate -c" to
behave as it currently does. So the question is, should "emulate -c":
1. Stay exactly as it is, i.e., error on extra arguments?
2. Assign arguments to $@, ala "set -- rest", before eval'ing "first"?
3. Pass all of the non-option arguments following -c, to "eval"?
Of these, 2 is the most complicated to implement, and raises the added
question of whether $@ should be set only for the duration of the eval,
somewhat as if "emulate" was itself a shell function, or should instead
persist as the emulation mode itself does.
In the absence of feedback, #1 wins.
Messages sorted by: