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

Re: triviality with prompts

On Dec 3, 2014, at 11:20 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:

> Thanks, that's a nice summary.  It's especially nice of it to mention
> the $'foo' gotcha, which is ignored in other docs.  Just when I thought
> I knew what a single quote was :(

It's not really a gotcha; the dollar sign frequently has special meaning
in shell scripts. As a rule of thumb, you shouldn't ever assume that
a "$" is a literal.

> But the zshbuiltins page, under 'print' doesn't go into any detail about
> this $'foo' form.

zshmisc(1) says:

    A string enclosed between `$'' and `'' is processed the same way as
    the string arguments of the print builtin, and the resulting string
    is considered to be entirely quoted.

Which means you want to figure out how the print builtin treats its
string arguments, from zshbuiltins(1):

    With no flags or with the flag `-', the arguments are printed on the
    standard output as described by echo, with the following

Then you probably also want to look up what echo does:

    Write each arg on the standard output, with a space separating each
    one. If the -n flag is not present, print a newline at the end. echo
    recognizes the following escape sequences...


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