Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: indented heredocs
- X-seq: zsh-workers 40228
- From: Philippe Troin <phil@xxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: indented heredocs
- Date: Thu, 22 Dec 2016 11:04:49 -0800
- In-reply-to: <CAH+w=7aWm9ZTYr2mh_1T+9mmHQXN9L_CYz878FoqMzwUerL72w@mail.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CFA2339B-26F2-4104-AAD2-64852509286B@yost.com> <CAH+w=7bGEb13SUxX-whdHzWRktoiMdvgSosJvcEoZ+t0z3FOhA@mail.gmail.com> <CAH+w=7aWm9ZTYr2mh_1T+9mmHQXN9L_CYz878FoqMzwUerL72w@mail.gmail.com>
On Wed, 2016-12-21 at 15:04 -0800, Bart Schaefer wrote:
> On Wed, Dec 21, 2016 at 2:10 PM, Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > % cat <<-' xx'
>
> Chet Ramey reminds me (palm to forehead) that this already means to
> quote the here-document content. So, we'd need some other way of
> quoting the leading whitespace.
Isn't the whole thing overkill?
We already can handle the simple cases:
cat <<EOD will use the document as is
cat <<-EOD will strip leading tabs
If you want anything fancier, you can always used sed:
sed -e 's!^ !!' <<EOD
or even zsh itself:
while read -r line; do print -r ${line# }; done <<EOD
Phil.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author