Hi all,
It's probably best to start with the example:
$ bash -c 'echo "${x:-"}"}"'
}
$ ksh -c 'echo "${x:-"}"}"'
}
$ dash -c 'echo "${x:-"}"}"'
dash: 1: Syntax error: Unterminated quoted string
$ busybox sh -c 'echo "${x:-"}"}"'
sh: syntax error: unterminated quoted string
It looks like dash and other ash derivatives stop the expansion with the
first }, instead of the first unquoted }. I'm getting confused trying to
figure out whether this is a bug in dash or in the script relying on it.
A slightly modified example:
$ dash -c 'echo "${x-"_{x}_"}"'
dash: 1: Syntax error: Unterminated quoted string
$ dash -c 'echo ${x-"_{x}_"}'
_{x_}
I don't understand how the last line works. The } is printed after the
_, so the } that is printed must be the final }, and the } directly
following the x stops the variable default. But this would lead to two
double quote characters which have no way of matching up, yet no syntax
error is given.
Could you clarify?
Cheers,
Harald
--
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