[m-rev.] for review: shell script fixes

Peter Wang novalazy at gmail.com
Sat May 30 11:39:37 AEST 2020


On Fri, 29 May 2020 18:28:08 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> Another issue this brought up for me is: should we prefer
> modern bash-isms such as $(...) over the old Bourne sh
> equivalents such as `...`? Any opinions?

$() is defined in POSIX shell.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03
I do not know of any sh still in use that does not support $().

Shellcheck assumes the shell dialect from the shebang so it should not
suggest any bash-specific constructs if the script begins with #!/bin/sh.

Peter


More information about the reviews mailing list