Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: question about quoting % in preexec
- X-seq: zsh-users 7939
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Andy Spiegl <zsh.Andy@xxxxxxxxx>
- Subject: Re: question about quoting % in preexec
- Date: Fri, 27 Aug 2004 17:54:34 +0200
- Cc: ZSH User List <zsh-users@xxxxxxxxxx>
- In-reply-to: <20040827152008.GA19748@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040827152008.GA19748@xxxxxxxxx>
Andy Spiegl wrote:
> 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?
It would be easier to just split it across extra print commands:
print -Pn '\033]0;%n@%m <'
print -rn -- "${(Vq)2}"
print -Pn '> %~\007'
The -r option does raw output so no escapes are interpreted.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author