google-style-precommit-hook icon indicating copy to clipboard operation
google-style-precommit-hook copied to clipboard

This line isn't posix shell compatible

Open jedimatt42 opened this issue 4 years ago • 1 comments

https://github.com/maltzj/google-style-precommit-hook/blob/95c2f5632710e095220e22cc1a4e1a1451abf75f/format-code.sh#L11

$(command) is a bash or other new shell issue. On many systems sh is a posix limited shell.

This issue is fixed in https://github.com/maltzj/google-style-precommit-hook/pull/17

jedimatt42 avatar Mar 09 '21 01:03 jedimatt42

The $(command) command substitution is part of the POSIX standard and is not a bashism. It should work in POSIX compliant shells. If it doesn't work in your shell, it appears your shell isn't POSIX compliant.

2.6.3 Command Substitution Command substitution allows the output of a command to be substituted in place of the command name itself. Command substitution shall occur when the command is enclosed as follows:

$(command)

or (backquoted version):

command

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03

berney avatar May 11 '22 10:05 berney