Re: Expansion-lookalikes in heredoc delimiters

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

 



On 15/03/2018 11:27, Herbert Xu wrote:
Harald van Dijk <harald@xxxxxxxxxxx> wrote:

Changing dash to support this would in my opinion be unreasonable, as it
would require a total rewrite of the parser.

I don't think it's that hard.

It is if you want to do it the way POSIX specifies. You're adding a special exception in the parser. I don't see how this approach can be extended to handle the other examples in my mail:

  cat <<`one two`
  ok
  `one two`

`one two` is a single word, so should be allowed as a heredoc delimiter. By treating ` as a literal and not looking for the matching closing `, this only ends up taking `one as the delimiter, does it not?

And to hopefully better demonstrate the need to not introduce special parsing exceptions:

  cat <<$(case x in 0) echo bug ;; esac)
  ok
  $(case x in 0) echo bug ;; esac)

Yes, this actually works in bash/zsh/yash.

Cheers,
Harald van Dijk
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux