You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a snippet or screenshot that shows the problem:
#!/bin/shusage() {
echo"$0 [-a text] [-b]"exit 1
}
whilegetopts"ab" opt;docase"$opt"in
a) foo=$OPTARG ;;
b) alias bar=true ;;
*) usage ;;
esacdoneecho"$foo"
Here's what shellcheck currently says:
No issues detected!
Here's what I wanted or expected to see:
Something similar to OPTARG used in option case a but no colon specified after a in optstring.
Shellcheck should warn that foo is being assigned to $OPTARG when there is no colon after a in the optstring. This could lead to the user expecting foo to get a value but no value being passed to the script command line arguments.
The text was updated successfully, but these errors were encountered:
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
No issues detected!
Here's what I wanted or expected to see:
Something similar to
OPTARG used in option case a but no colon specified after a in optstring
.Shellcheck should warn that
foo
is being assigned to $OPTARG when there is no colon aftera
in the optstring. This could lead to the user expectingfoo
to get a value but no value being passed to the script command line arguments.The text was updated successfully, but these errors were encountered: