]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
treewide: fix unnecessary $ on arithmetic variables
authorDmitry V. Levin <ldv@strace.io>
Fri, 31 Mar 2023 08:00:00 +0000 (08:00 +0000)
committerMike Yuan <me@yhndnzj.com>
Fri, 31 Mar 2023 17:48:44 +0000 (01:48 +0800)
This should fix shellcheck warning SC2004.

shell-completion/bash/busctl
shell-completion/bash/portablectl
test/units/testsuite-35.sh
test/units/testsuite-57-short-lived.sh
test/units/testsuite-59.sh

index cebd25a87180e89f7235979625974db27cbc7612..ee160a79008c96dae0cbc0bd030677ad6877b50d 100644 (file)
@@ -139,7 +139,7 @@ _busctl() {
         fi
     done
 
-    n=$(($COMP_CWORD - $i))
+    n=$((COMP_CWORD - i))
 
     if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
index 71789277b09f8fced1e59c7d930be4eba5269d80..31601dceb29ab641232dfb3b21c8eb3fe0498241 100644 (file)
@@ -78,7 +78,7 @@ _portablectl() {
         fi
     done
 
-    n=$(($COMP_CWORD - $i))
+    n=$((COMP_CWORD - i))
 
     if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
index 8dcd7563bb4081bfee5401ee769e5a13de29ed00..0b83a6a536b5c080ce3220b166e25f9cca6da384 100755 (executable)
@@ -591,7 +591,7 @@ test_ambient_caps() {
     # CAP_CHOWN | CAP_KILL
     MASK=$(((1 << 0) | (1 << 5)))
 
-    if [ $(("$BND" & "$MASK")) -ne "$MASK" ] ; then
+    if [ $((BND & MASK)) -ne "$MASK" ] ; then
         echo "CAP_CHOWN or CAP_KILL not available in bounding set, skipping test." >&2
         return
     fi
index 115b0d56f66c53acd45ea91973e3fb02f5c5ad40..e596392204ef2a562a358c7646024b6483e3c87d 100755 (executable)
@@ -4,7 +4,7 @@ set -ex
 
 if [ -f /tmp/testsuite-57.counter ] ; then
     read -r counter < /tmp/testsuite-57.counter
-    counter=$(("$counter" + 1))
+    counter=$((counter + 1))
 else
     counter=0
 fi
index db8dc27ab9d9faff2efd5b30c5c4c166c4cce565..aabebb2bb60ba65bd107d345fa8f1032ab26ed1b 100755 (executable)
@@ -116,13 +116,13 @@ LEAVE=0
 
 function reload() {
     systemd-notify --reloading --status="Adding 11 to exit status"
-    EXIT_STATUS=\$((\$EXIT_STATUS + 11))
+    EXIT_STATUS=\$((EXIT_STATUS + 11))
     systemd-notify --ready --status="Back running"
 }
 
 function leave() {
     systemd-notify --stopping --status="Adding 7 to exit status"
-    EXIT_STATUS=\$((\$EXIT_STATUS + 7))
+    EXIT_STATUS=\$((EXIT_STATUS + 7))
     LEAVE=1
     return 0
 }
@@ -138,7 +138,7 @@ while [ \$LEAVE = 0 ] ; do
 done
 
 systemd-notify --status="Adding 3 to exit status"
-EXIT_STATUS=\$((\$EXIT_STATUS + 3))
+EXIT_STATUS=\$((EXIT_STATUS + 3))
 exit \$EXIT_STATUS
 EOF