#!/bin/sh
usage() {
echo "$0 [-a text] [-b]"
exit 1
}
while getopts a: opt; do
case "$opt" in
a) foo=$OPTARG ;;
b) alias bar=true ;;
*) usage ;;
esac
done
echo "$foo"
No issues detected!
Something along the lines of Attempting to handle option "b" not present in getopts' optstring.
This feature has been added in 4243c6a. It only works for getopts (not getopt) in strictly canonical while loops like this one.
Great suggestion. It's high frequency so it'll actually trigger, high precision so it won't be noisy, and high level so you'll be impressed when it's caught ^^
Incorrect commit link.
I think this is the correct one https://github.com/koalaman/shellcheck/commit/070a465b64f07600
Oops! Yes, that's the one
Awesome, thanks!
Most helpful comment
This feature has been added in 4243c6a. It only works for
getopts(notgetopt) in strictly canonical while loops like this one.Great suggestion. It's high frequency so it'll actually trigger, high precision so it won't be noisy, and high level so you'll be impressed when it's caught ^^