zsh-workers
 help / color / Atom feed
From: Aryn Starr <whereislelouch@icloud.com>
To: Stephane Chazelas <stephane.chazelas@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [Feature Request] Adding option to support triple quotes
Date: Thu, 15 Aug 2019 18:58:04 +0430
Message-ID: <FC9B9636-8D8F-4418-AB20-2882CF2DF639@icloud.com> (raw)
In-Reply-To: <20190814095449.s7mgevyo5tdhfyby@chaz.gmail.com>

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@gmail.com> 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
> 
> 
> 
> 


  reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  6:06 Aryn Starr
2019-08-13  9:06 ` Mikael Magnusson
2019-08-13 20:52   ` Aryn Starr
2019-08-13 16:28 ` Daniel Shahaf
2019-08-13 20:40   ` Aryn Starr
2019-08-14  9:54 ` Stephane Chazelas
2019-08-15 14:28   ` Aryn Starr [this message]
2019-08-15 15:56     ` Daniel Shahaf
     [not found] <2c845fb0-d628-400f-a805-ad8356b6d87a@www.fastmail.com>
     [not found] ` <7EBD1ADA-7179-4EEF-97CA-DBE4371D80D6@icloud.com>
     [not found]   ` <876f807b-dfdd-4246-8cfe-7cf6f373ac88@www.fastmail.com>
     [not found]     ` <f053e72e-e22e-4729-a2de-eaa712119728@www.fastmail.com>
2019-08-15 16:23       ` Aryn Starr
2019-08-17  5:31         ` Bart Schaefer
2019-08-17  6:30           ` Stephane Chazelas
2019-08-17  8:19             ` Stephane Chazelas
2019-08-18  4:24             ` Mikael Magnusson

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FC9B9636-8D8F-4418-AB20-2882CF2DF639@icloud.com \
    --to=whereislelouch@icloud.com \
    --cc=stephane.chazelas@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git