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

Re: first adventures

On Sat, 01 Nov 2014 09:35:49 -0700
Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> But there are
> situations where I have to pass a literal ' \n ' to  a command, so I was 
> wanting it unmolested.  Is there, or
> could/should there be some way of leaving builtin 'special' characters 
> alone?

That's exactly what quoting is for. '\n' is probably the easiest way of
doing it.  Single quotes quote everything except single quotes (and
with RC_QUOTES you can do that, too).

> Philosophically tho, it seems strange that zsh can prepare coffee in 
> more ways than Starbucks, but getting a raw coffee bean is difficult.

This isn't fair in this case.  The character \ was picked to be a
special character because it isn't commonly used in normal text.  So
it's special to the command line.  You now need it to be special
somewhere else *as well*, at a later stage, for something that also
picked the backslash to be special for exactly the same reason.  It's
not surprising that takes a bit of doing.

With your analogy, you're trying to put a coffee bean into a roaster and
saying that you want it to emerge unscathed in such a way that it can be roast by
something else after it emerges.

If you want text not to be processed by the shell, the best way of doing
that is to pass it via standard input and output rather than the command
line, using "read -r" and "print -r".


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