diff options
| author | Alejandro Colomar <alx@kernel.org> | 2025-10-29 23:40:38 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2025-10-31 12:22:57 +0100 |
| commit | bf66f1bcbf6b5a0278ecbc0f5cf00fd5b14acd0d (patch) | |
| tree | 2e53bff1208c30cabd56a6451d07464ebed12a29 | |
| parent | 204b31b03f1732d20ba2b5bf06b18e2ede8bc1e6 (diff) | |
| download | man-pages-bf66f1bcbf6b5a0278ecbc0f5cf00fd5b14acd0d.tar.gz | |
src/bin/grepc: Add defensive check
In theory, getopts(1) will make sure that no other values arrive here.
However, it's easy to add a check, and that will be safer than silencing
shellcheck(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
| -rwxr-xr-x | src/bin/grepc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/bin/grepc b/src/bin/grepc index 102396273c..4f92c8638f 100755 --- a/src/bin/grepc +++ b/src/bin/grepc @@ -52,7 +52,6 @@ grepc_err() while getopts "A:B:C:chilm:nrt:x:" opt; do - # shellcheck disable=SC2249 # getopts(1) uses '?' for an error. case "$opt" in A) A="-A$OPTARG"; ;; B) B="-B$OPTARG"; ;; @@ -133,7 +132,7 @@ while getopts "A:B:C:chilm:nrt:x:" opt; do ;; esac; ;; - \?) + \? | *) exit 1; ;; esac; |
