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

question about quoting % in preexec



I am using the following preexec-function to display the currently running
process in my xterm-title:

      preexec () {
        print -Pn "\033]0;%n@%m <${(Vq)2}> %~\007"
        print -Pn $icontitle
      }

But if I run a command with "%" in the arguments, e.g.:
 date "+%Y-%m-%d %H:%M:%S"

it leads to very unwanted results because zsh interprets it as variables.
How can I avoid this?  I suppose I have to quote the %s but how?

Thanks so much for your help,
 Andy.

-- 
                              o      _     _         _
  ------- __o       __o      /\_   _ \\o  (_)\__/o  (_)          -o)
  ----- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/       /\\
  ---- (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_    _\_v
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Money often costs to much.  -- Ralph Waldo Emerson



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