On Dec 04, 07 18:51:12 +0100, Hans Ulrich Niedermann wrote:
$(cmd) is not a bashism. $(cmd) is POSIX sh, and is supported by most shs even if they are not strictly POSIX in other ways.
Ok, didn't know that this is POSIX now. I just remember the days when one had to write 'if [ "x$1" != x ] ; then' in order to not get bashed by sh (what a phrase ;)
Correct quoting with $() is easy (for file and directory names with spaces e.g.). Correct quoting and escaping with `` frankly escapes me, though, and IIRC there were some things that could not be quoted correctly at all with ``. You're welcome to help me there, of course.
It's not as complex - as long as no additional ` is included, all escaping in the subshell is unrelated, so a="`cmd "single argument"`" is perfectly valid and working. Nevertheless, you're used to $(), so keep it.
E.g. git's scripts use sh functions and $() substitution.
Strong point.
Matthias
--
Matthias Hopf