It is my understanding that the more modern
$(...) command substitution syntax is preferred over the old
`-based syntax, due to easier and less error-prone nesting and escaping syntax.
Further, it seems that most
/bin/sh-style shells in modern use support
- ash (and therefore BusyBox, so most embedded Linux)
- FreeBSD /bin/sh
$(…) is specified by IEEE 1003.1.
So I have 2 very related questions:
- Is there any reason to use ` in new development of shell scripts unless you know of a specific old system that the script will need to run on?
- Is there any reason not to teach UNIX programming students just to write
$(...), and discuss
`only as an obsolete variant that they will likely encounter if they are reading other developers' shell scripts (and may need if they are working with a really old system or nonstandard for some reason)?