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

Re: indented heredocs



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