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

prompt quoting question



I have a right-prompt string:

export RPS1="%{$(print -n '\e[1;34m')%} `/usr/bin/tty | sed -e 's/\/dev\/tty//'`  \
%{$(print -n '\e[1;32m')%}%D{%A  %Y/%m/%d  %T} %{$(print -n '\e[m')%}"

which works fine, creating:

                                     r8  Monday  2001/08/27  00:29:49


where the tty (r8) is blue and the rest is green.  But this is the old style
of creating colors.  With the new, I know I need something like:

export RPS1=$'%{\e[1;34m%} tty  %{\e[1;32m%}%D{%A  %Y/%m/%d  %T} %{\e[m%}'

But when I replace "tty" in the line above with `/usr/bin/tty | sed -e 's/\/dev\/tty//'`
instead of displaying the tty number, the prompt is messed up:

                 \e[1;32mMonday  2001/08/27  00:14:45 \e[mv

and sed gives me an error message:

                 sed: 1: "s//dev/tty//": bad flag in substitute command: 't'

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.  Any clues
appreciated.

-- 
                                 // rj@xxxxxxxxx //



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