zsh-workers
 help / color / mirror / code / Atom feed
* Additional arguments to "emulate -c"
@ 2017-04-16  4:09 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2017-04-16  4:09 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-16  4:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-16  4:09 Additional arguments to "emulate -c" Bart Schaefer

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).