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

Re: [Feature Request] Adding option to support triple quotes



That EOF solution is good if there is a lot of text, but for short snippets, it’s too many characters to type. Completely against the shell’s spirit of arcane brevity. :))
I also thought of a (kind of) new application for the triple quotes. I think it’ll enable a lot more functions like this:
cc() python -c "from math import *; print($*);"
Since we’ll be able to easily write the target language’s code in our shell, with minimal typing.

> On Aug 14, 2019, at 2:24 PM, Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> 
> 2019-08-13 10:36:53 +0430, Aryn Starr:
>> Adding an option to zsh to support triple quotes
>> (TRIPLE_QUOTES) would make possible much more readable code.
> [...]
> 
> We could also implement mksh's "$(<<'EOF'
> arbitrary text that mustn't end in empty lines
> EOF
> )"
> 
> That already works in zsh, but is not optimised like in mksh as
> it does "$(cat <<'EOF'
> arbitrary text that mustn't end in empty lines
> EOF
> )" while mksh treats it specially as effectively a kind of
> quotes.
> 
> mksh also supports $(<<'EOF'
> foo
> EOF)
> 
> (though that's probably not POSIX).
> 
> See also perl's q(...) and qq(...) that are more compatible with
> the shell syntax than those python '''/""".
> 
> See:
> 
> $ a="'"; print -r ${(qq)a}
> ''\'''
> 
> -- 
> Stephane
> 
> 
> 
> 



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