morbig
morbig copied to clipboard
falis when a here-document delimiter contains a variable or subshell
Morbig fails with "Failure: Unsupported expansion in here document delimiter" on the following script
cat << $x
kgjlkfdjgkdflkg
$x
bash accepts it both with with and without --posix, and dash gives an error.
I think that the behaviour of bash is correct since nothing in the standard says that the delimiter word may not contain variables, subshells, or globs. However these are not subject to expansion, as stated in 2.7.4.
this is fixed for a delimiter containing a variable, but it still fails when the delimiter contains a subshell
cat <<$(something)
abc
$(something)
this is refused by dash, but accepted by bash --posix. I think that dash is wrong.