shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

`is-macos() [[ $OSTYPE == darwin* ]]` is valid Bash

Open ingydotnet opened this issue 3 years ago • 0 comments

I just realized that:

is-macos() [[ $OSTYPE == darwin* ]]

Is a valid Bash (3.2+) function definition.

A cleaner alternative to:

is-macos() ( [[ $OSTYPE == darwin* ]] )
or:
is-macos() { [[ $OSTYPE == darwin* ]]; }

shellcheck 0.8.0 gives:

is-macos() [[ $OSTYPE == darwin* ]]
           ^-- SC1064 (error): Expected a { to open the function definition.
           ^-- SC1072 (error):  Fix any mentioned problems and try again.

Also valid Bash (3.2+):

big-num() (( $1 > 9 ))

Fortunately I can disable these for now.

ingydotnet avatar Sep 18 '22 15:09 ingydotnet