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

Re: Printing square brackets and backslashes



    Hi all :)

    Just a note:

 * DervishD <zsh@xxxxxxxxxxxx> dixit:
>     Hi all :)
> 
>     $ print \[\\\]
>     []
>     $ /bin/echo -e \[\\\]
>     [\]
>     $ print -r \[\\\]
>     [\]
>     $ print \\
>     \

    I can understand the first case, but I don't understand the last
one: in the first case, what I misunderstood is that the shell quotes
the chars, producing "[\]" and "print" prints them, interpreting some
escape directives: "[]". But in the last case, nothing should then be
printed, because zsh quotes the backslash and "print" gets a single
backslash, that is, an empty escape directive that shouldn't print
anything :? Is "print" assuming that a single backslash is not an
empty escape directive? Is a single, isolated backslash a synonim for
"\\"?

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...



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