Hi.

Thank for your answer.

Will ksh93 version ever get to upstream? This ugly 'bug' is here for decades and really irritates me and many people, who ever used shell for larger scripting and don't like to use tabs.

Best regards
P.

On 8/30/21 11:14 PM, Lawrence Velázquez wrote:
On Mon, Aug 30, 2021, at 4:06 PM, Přemysl Šťastný wrote:
I think, it would be nice, if you implemented Squiggly heredoc, which
solves this problem by ignoring both leading spaces and leading tabs. eg.

func()(
    cat <<~ EOF
      blabla
    EOF
)
'<<~' is already syntactically valid.

     bash-5.1$ cat <<~
     heredoc> foo
     heredoc> bar
     heredoc> ~
     foo
     bar

     bash-5.1$ cat <<~EOF
     heredoc> foo
     heredoc> bar
     heredoc> ~EOF
     foo
     bar

     bash-5.1$ echo abc >EOF; cat <<~ EOF
     heredoc> foo
     heredoc> bar
     heredoc> ~
     abc

ksh93s (I think) implemented a version of this behavior using '<<#'.
That's currently a syntax error in bash, unless interactive_comments
is disabled.

     bash-5.1$ shopt -s interactive_comments
     bash-5.1$ cat <<# EOF
     bash: syntax error near unexpected token `newline'

     bash-5.1$ shopt -u interactive_comments
     bash-5.1$ echo abc >EOF; cat <<# EOF
     heredoc> foo
     heredoc> bar
     heredoc> #
     abc


Attachment: OpenPGP_0x2FD4F23C65C1A5F0_and_old_rev.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to