usr_bin/grml-lang: Fix a couple of shellcheck warnings
authorDarshaka Pathirana <dpat@syn-net.org>
Fri, 4 Dec 2020 10:49:12 +0000 (11:49 +0100)
committerDarshaka Pathirana <dpat@syn-net.org>
Fri, 3 Dec 2021 11:54:54 +0000 (12:54 +0100)
- SC2034: PN appears unused. Verify use (or export if used externally).
- SC2086: Double quote to prevent globbing and word splitting.
- Ignore SC1091: Not following: /etc/grml/language-functions was not specified as input (see shellcheck -x).

SC1117 was retired due to noise in koalaman/shellcheck@d8a32da07.

Makefile
usr_bin/grml-lang

index 6e0dc8d..82019a7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ all: codecheck spellcheck ## Run codecheck and spellcheck
 codecheck: shellcheck pythoncheck ## Run shellcheck and pythoncheck
 
 shellcheck: ## Run shellcheck
-       for shellfile in usr_bin/* usr_sbin/* usr_share/*; do head -1 "$${shellfile}" | grep -q "/bin/bash\|/bin/sh" && shellcheck "$${shellfile}"; done
+       for shellfile in usr_bin/* usr_sbin/* usr_share/*; do head -1 "$${shellfile}" | grep -q "/bin/bash\|/bin/sh" && shellcheck -x "$${shellfile}"; done
 
 .ONESHELL:
 pythoncheck: ## Run shellcheck
index 0e774ae..52b81a0 100755 (executable)
@@ -7,10 +7,10 @@
 ################################################################################
 
 CONFFILE=/etc/default/keyboard
-PN="$(basename $0)"
+PN="$(basename "$0")"
 
 usage(){
-    echo "Usage: $0 <language>"
+    echo "Usage: ${PN} <language>"
     echo "supported values: at, ch, de, dvorak, es, fr, it, jp, us"
 }
 
@@ -26,6 +26,7 @@ fi
 
 LANGUAGE="$1"
 
+# shellcheck disable=SC1091
 . /etc/grml/language-functions
 
 if [ -n "$XKEYBOARD" ] ; then