zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Russell Hoover <rj@panix.com>, zsh-users@sunsite.dk
Subject: Re: prompt quoting question
Date: Mon, 27 Aug 2001 08:06:44 +0000	[thread overview]
Message-ID: <1010827080644.ZM32436@candle.brasslantern.com> (raw)
In-Reply-To: <20010827004932.A11967@panix.com>

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   


      parent reply	other threads:[~2001-08-27  8:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-27  4:49 Russell Hoover
2001-08-27  7:50 ` Preben Guldberg
2001-08-27  8:06 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010827080644.ZM32436@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=rj@panix.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).