Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prompt quoting question
- X-seq: zsh-users 4169
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Russell Hoover <rj@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: prompt quoting question
- Date: Mon, 27 Aug 2001 08:06:44 +0000
- In-reply-to: <20010827004932.A11967@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20010827004932.A11967@xxxxxxxxx>
On Aug 27, 12:49am, Russell Hoover wrote:
}
} It seems to me the problem is in correctly quoting the 's/\/dev\/tty//' :
} the single quotes (within backtics within single quotes) won't cut it.
Backticks within single quotes are not recognized as quotes. Quotation
forms normally do not nest. There are two exceptions, and both apply
only when the outermost quotes are double quotes:
1. Inside "$(...)", all forms of quoting may appear within the parens.
2. Inside "${...}", balanced double quotes may appear within the braces.
The possible solutions are:
a. Use double quotes (or none at all) around the argument to sed.
RPS1=$'...`/usr/bin/tty | sed -e s@/dev/tty@@`...'
b. End the $'...' expression before you begin some other quoting.
RPS1=$'...''`/usr/bin/tty | sed -e s@/dev/tty@@`'$'...'
Neither helps in cases where the nesting quotes can't be eliminated by
other trickery; (b) might be simpler in some circumstances, but not in
this case.
For this particular question, though, I think the best solution is:
c. Use the %l or %y prompt escape instead of that sed command.
RPS1=$'%{\e[1;34m%} %l %{\e[1;32m%}%D{%A %Y/%m/%d %T} %{\e[m%}'
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author