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

Re: /usr/bin/printf



Bart Schaefer wrote:
> The (q) tells zsh to insert a backslash before any special characters
> that appear in the value of $1, including the backslash in "\n".  Then
> "print" strips the extra backslashes off again and the final output is
> the original string.
> 
> Or, well, it would be, except there's that -P option there, which will
> turn any %x (for any x) in your $1 into some sort of prompt expando.
> So you really need to do this in two steps, one to do the prompt
> expansion and one to handle the value of $1.

Okay, that makes sense.

> preexec () { print -Pn "\e]0;%n@%m: "; print -n "${(q)1}\a" }

It works great.  Thanks.

Matt Flaschen



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