Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Feature Request] Adding option to support triple quotes
- X-seq: zsh-workers 44667
- From: Aryn Starr <whereislelouch@xxxxxxxxxx>
- To: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- Subject: Re: [Feature Request] Adding option to support triple quotes
- Date: Thu, 15 Aug 2019 18:58:04 +0430
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1565879288; bh=U6Os6bHjXWrpKDIvVgQYcAnQdrpT7Owy6yZGGnps43k=; h=Content-Type:Subject:From:Date:Message-Id:To; b=jYFlgxMpjDb4GxDfBuE3jVQXQAQo7ueU1iN/Z42zuqP1nibaosZVLaaHJ1ImMP2y6 cfyJ17A/hDQSSolzyew8yY3phFpLGdtROuXDmYrh9VcSRcjxR7vhaXPqkuB6JoyxnV H88EfbIhjKwxQcWAmt2XdMetSISyt3rkQRSWZS45tBLP9fEI7g7uhBUZPohNiikRZY RJST/l6om7+FsyJFxvF8HBcMEazxk+eNWXZabd0cooPpT/CgPvOVo0sxGq0vD//1Kn YGFjPuNn8YoGfRa5dCdAebJW/GJ5pYfmLwheudd3xp+cPvFAQb4IkwM3ljCxejn04G /mOrOZk246c6A==
- In-reply-to: <20190814095449.s7mgevyo5tdhfyby@chaz.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <6EA30061-5610-4CCA-93FB-0A160E2002A3@icloud.com> <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@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