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

Re: Printing square brackets and backslashes



    Hi Chris :)

 * Chris Johnson <cjohnson@xxxxxxxxxx> dixit:
> DervishD sent me the following 0.9K:
> 
> > >     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
> > "\\"?
> 
> This is in the zsh user's guide at:
> 
>    http://zsh.sourceforge.net/Guide/zshguide03.html#l32
> 
> Look under section 3.2.1, Builtins for printing.

    Thanks!. I read the Guide a time ago and obviously I missed this.
Thanks again, Chris, it has been very useful :)

    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