Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: /usr/bin/printf
- X-seq: zsh-users 13835
- From: Matthew Flaschen <matthew.flaschen@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: /usr/bin/printf
- Date: Thu, 12 Feb 2009 23:09:33 -0500
- In-reply-to: <090212192523.ZM11726@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <4994CFCF.2090408@xxxxxxxxxx> <237967ef0902121751k37dd810co312238682d9b60f0@xxxxxxxxxxxxxx> <4994E32E.2050508@xxxxxxxxxx> <090212192523.ZM11726@xxxxxxxxxxxxxxxxxxxxxx>
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