Re: Expansion-lookalikes in heredoc delimiters

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

 



On Thu, Mar 15, 2018 at 12:41:10PM +0100, Harald van Dijk wrote:
>
> 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:

I don't think it's exactly clear what POSIX says on this.

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

Try this one:

	cat << ${
	${

bash/ksh93 both will get stuck forever until a right brace is
entered.  While other shells all behave the way dash does.
Considering the fact that even if you closed the brace after
the newline bash would still be stuck forever, I think this
behaviour is suboptimal.  ksh93 seems to do the right thing though.

Another interesting thing to try is

	cat << ${ foo
	${

Also you can look at the quotes:

	cat << "
	"

IOW it's not clear that "word" in this context necessarily follows
the same rules used during normal tokenisation.

Anyway, dash has had CHKEOFMARK since 2007 so this is just an
extension of existing behaviour.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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