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

Re: Preexec & Printf



${(qV)1} appears to be doing the job in 3.1.9, in 3.0.8 (the version
that comes with solaris 9) or 3.0.6 (the version that comes with solaris
8) it gives a syntax error.
However with ${(QV)1} I still get garbage into my shell.

[(ichirou:38:pts/22)~ %] which preexec
preexec () {
        print -Pn "\e]0;%m:%l   -   ${(QV)1} \a"
}
[(ichirou:39:pts/22)~ %] printf '^[[32;40mwith
quotes\n'                    
                                                         
  with quotes
[(ichirou:40:pts/22)~ %] 

[(ichirou:40:pts/22)~ %] which preexec
preexec () {
        print -Pn "\e]0;%m:%l   -   ${(qV)1} \a"
}
[(ichirou:41:pts/22)~ %] printf '^[[32;40mwith quotes\n' 
with quotes
[(ichirou:42:pts/22)~ %] 

- Josh -

----- Original Message -----
From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Date: Thursday, April 25, 2002 8:45 pm
Subject: 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 
> thepreexec 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 
> probablywant ${(QV)2} or maybe just ${(V)2}.
> 
> 



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