[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: smart indented HERE docs

From: Pierre Gaston
Subject: Re: smart indented HERE docs
Date: Mon, 22 Aug 2016 08:58:05 +0300

On Mon, Aug 22, 2016 at 6:47 AM, Derek Schrock <address@hidden> wrote:

Would it be possible to add a new character (+) to the here-doc such
that the number of tabs remove are the number after the closing
delimiter (EOF in the above example):

        cat <<+ EOF
                Testing 0 9 8
                Testing 7 6 5
                Testing 4 3 2

Note the above here-doc is tabbed out by two but the closing delimiter
is only tabbed by 1 so only 1 tab is removed.

Would result with:

        Testing 0 9 8
        Testing 7 6 5
        Testing 4 3 2

This would allow you to write here-docs inside functions and continue to
use tabs to maintain proper formatting and not have to use spaces.

I think it is a bit cumbersome and hard to see this way, as well as a bit difficult to maintain this way....

Would it not be more simple to just  use the number of tabs (or spaces for tab haters) before the first non tab character of the first line of the here doc?
I think most people would be happy with this kind of "do what I mean" behavior....maybe except  those using + as the first char of their delimiter of course .

reply via email to

[Prev in Thread] Current Thread [Next in Thread]