]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
completion: fix 'unbound variables' errors
authorLuca Boccassi <luca.boccassi@microsoft.com>
Tue, 22 Jun 2021 13:56:19 +0000 (14:56 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 Jul 2021 15:54:10 +0000 (17:54 +0200)
Fixes https://github.com/systemd/systemd/issues/19987

(cherry picked from commit 36ec026830c6978be8bd39f3c6d1d7822495e07f)
(cherry picked from commit fe13c0bd40bc5ccdda61b8b474194920543a617b)

17 files changed:
shell-completion/bash/bootctl
shell-completion/bash/busctl
shell-completion/bash/coredumpctl
shell-completion/bash/homectl
shell-completion/bash/hostnamectl
shell-completion/bash/localectl
shell-completion/bash/loginctl
shell-completion/bash/machinectl
shell-completion/bash/networkctl
shell-completion/bash/portablectl
shell-completion/bash/resolvectl
shell-completion/bash/systemctl.in
shell-completion/bash/systemd-analyze
shell-completion/bash/systemd-delta
shell-completion/bash/systemd-id128
shell-completion/bash/timedatectl
shell-completion/bash/udevadm

index 391fa67bfc1c4c155112db1fc9747bc9694b28b8..e61188fee94047126a62a12f0caac7a75ef207a8 100644 (file)
@@ -69,7 +69,7 @@ _bootctl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
         comps=''
index 5a4acd337ff31e19aea5cadcae7705dc46402408..1cc41d461870b943dd4ca8897b2584d3b944906a 100644 (file)
@@ -140,7 +140,7 @@ _busctl() {
 
     n=$(($COMP_CWORD - $i))
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
         comps=''
index 20886932e223b4e7693b692c61c9f22bf298207a..7b50ed610db24049017961d8cfa61be93b1562f8 100644 (file)
@@ -80,7 +80,7 @@ _coredumpctl() {
             fi
         done
 
-        if [[ -z $verb ]]; then
+        if [[ -z ${verb-} ]]; then
             comps=${VERBS[*]}
         elif __contains_word "$verb" ${VERBS[LIST]} ${VERBS[DUMP]}; then
             comps=''
index fe909fbb41151343a62714efc2c6c2c610cd81d6..f738bfb37f1e78a90c35c3bd4fe114e59abc1fb7 100644 (file)
@@ -170,7 +170,7 @@ _homectl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[NAME]}; then
         comps=$(__get_homes)
index e3765c315cbf0785af137ae8981c3c0532ec7678..71655cded46c7f3cfdfcb9985caa820159bcbf60 100644 (file)
@@ -50,7 +50,7 @@ _hostnamectl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[CHASSIS]}; then
         comps='desktop laptop convertible server tablet handset watch embedded vm container'
index fa0f8fdca1c9709b62a1d4ac163052cb64ce4925..987ae34cc9137b2ce7162c98b8056cd482bb1680 100644 (file)
@@ -67,7 +67,7 @@ _localectl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[VARIANTS]}; then
         comps=$(command localectl list-x11-keymap-layouts)
index ac85519c1088963b2645b25359d7bf7c5a6d9177..c15cc458fb2a0c7e9ce2cf197a0a0f6e1209047e 100644 (file)
@@ -93,7 +93,7 @@ _loginctl () {
         fi
     done
 
-    if   [[ -z $verb ]]; then
+    if   [[ -z ${verb-} ]]; then
         comps="${VERBS[*]}"
 
     elif __contains_word "$verb" ${VERBS[SESSIONS]}; then
index bc3a7889b3882e1b0fb880ae1721c49b286a40d9..0227167928a756e5c79f720d5f620e8249297f27 100644 (file)
@@ -95,7 +95,7 @@ _machinectl() {
         return 0
     fi
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
 
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
index ab2a5f7015ef6f1786f94e565e7a851e0f585992..d145015bf45d41c519da997f58b5793d65685245 100644 (file)
@@ -56,7 +56,7 @@ _networkctl() {
         return 0
     fi
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
         comps=''
index fe3d925d783eb9b3bcb37033e3e5f2568037629b..0b3368c7dcf6b1298519ae80040e69caf52213d0 100644 (file)
@@ -79,7 +79,7 @@ _portablectl() {
 
     n=$(($COMP_CWORD - $i))
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
         comps=''
index dae4330d4c5847a02dc5e1c72ec3367d3879dbf3..646a197a13f94e86465d7f62847d365e8bff2c1d 100644 (file)
@@ -87,7 +87,7 @@ _resolvectl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps="${VERBS[*]}"
 
     elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[DOMAIN]}; then
index b26381a324b5b541ce0ef4708a1d7124562f21a1..ae1ed48590b7954861d60319addfa415208c8830 100644 (file)
@@ -249,7 +249,7 @@ _systemctl () {
         cur_orig="$(printf '%q' $cur)"
     fi
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps="${VERBS[*]}"
 
     elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
index eded49b50e7d769029c7c1e1eca62e3ab7c7c2d9..36fcf432ff91b92ed675862802cbeca0ee523feb 100644 (file)
@@ -93,12 +93,12 @@ _systemd_analyze() {
         return 0
     fi
 
-    if [[ -z $verb  && $cur = -* ]]; then
+    if [[ -z ${verb-}  && $cur = -* ]]; then
         COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
         return 0
     fi
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
 
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
index 1a24dc07109889ab17271571e173936babb007e4..f94c1285332ad927ac41b07ed6c659b7919a1dd0 100644 (file)
@@ -53,7 +53,7 @@ _systemd-delta() {
         return 0
     fi
 
-    COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+    COMPREPLY=( $(compgen -W '${comps-}' -- "$cur") )
     return 0
 }
 
index 25110d13091948c1d92e50a6bbf22c515f8e3aad..ad4731de18f8798bb4e33cb7d2c6c567702eef4e 100644 (file)
@@ -61,7 +61,7 @@ _systemd_id128() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
         comps=''
index 3e72ce6655e1b80e8cd4cebbe4b3593243d93a8b..29dc27b39cc446283e5d4d4037ff6fc6eeb61f2b 100644 (file)
@@ -76,7 +76,7 @@ _timedatectl() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         comps=${VERBS[*]}
     elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then
         comps='true false'
index 8b1b962f2d49d21c01586ff78511cb78f66e9218..e1c1997ffe43da07aa9b9ce196703d4feb8b65cd 100644 (file)
@@ -73,7 +73,7 @@ _udevadm() {
         fi
     done
 
-    if [[ -z $verb ]]; then
+    if [[ -z ${verb-} ]]; then
         if [[ "$cur" = -* ]]; then
             COMPREPLY=( $(compgen -W '${OPTS[COMMON]} ${OPTS[DEBUG]}' -- "$cur") )
         else