Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Additional arguments to "emulate -c"

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: Reverse Date, Date, Thread, Author