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

Re: Preexec & Printf



On Thu, 25 Apr 2002, Joshua Symons wrote:

> I had seen q in the modifier list @
> http://zsh.sourceforge.net/Doc/Release/zsh_13.html#SEC45
> I don't see V and z in the modifier list, are they documented?

Unfortunately that's still the 3.0 -- or perhaps it's 3.1.6 --
documentation.  You need to read the docs that came with your zsh
distribution if you want accurate information.

> Additionally, where is the $* vs $1 documented, since I'm accustomed to
> $*.

The 3.1.9 doc (which I just happen to have lying around) says under the
preexec function:

     ... If the history mechanism is active, the string to be
     executed is passed as an argument.

Note "as AN argument", that is, the first and in this case only argument,
which is $1.  $* means all the arguments.

In 4.0.4, this has changed:

     ... If the history mechanism is active (and the line was not
     discarded from the history buffer), the string that the user typed
     is passed as the first argument, otherwise it is an empty string.
     The actual command that will be executed (including expanded
     aliases) is passed in two different forms: the second argument is
     a single-line, size-limited version of the command (with things
     like function bodies elided); the third argument contains the full
     text what what is being executed.

So in 4.0.4 if you use $* you'll get the command repeated three times,
which is definitely not what you want.  If you had 4.0.4, you'd probably
want ${(QV)2} or maybe just ${(V)2}.



Messages sorted by: Reverse Date, Date, Thread, Author