]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: make completions to work when bash set -u is in use
authorSami Kerola <kerolasa@iki.fi>
Fri, 30 Jun 2017 22:13:58 +0000 (23:13 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 15 Jul 2017 21:05:42 +0000 (22:05 +0100)
User who want to avoid refering to none-existing variables got earlier the
following error.

$ set -u
$ findmnt --output <tab>bash: OUTPUT: unbound variable

Here is short explanation of this setting.

$ help set
 -u  Treat unset variables as an error when substituting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14 files changed:
bash-completion/blkid
bash-completion/fdisk
bash-completion/fincore
bash-completion/findmnt
bash-completion/losetup
bash-completion/lsipc
bash-completion/lslocks
bash-completion/lsmem
bash-completion/partx
bash-completion/prlimit
bash-completion/sfdisk
bash-completion/swapon
bash-completion/wdctl
bash-completion/zramctl

index eb2ecf3fe0641c29c90f01e2a8120c2dd55e3127..57b34c3f45e41ed7be9634ad183f5be7c79b222c 100644 (file)
@@ -59,7 +59,7 @@ _blkid_module()
                prefix="${cur%$realcur}"
                for WORD in $OUTPUT_ALL; do
                        if ! [[ $prefix == *"$WORD"* ]]; then
-                               OUTPUT="$WORD $OUTPUT"
+                               OUTPUT="$WORD ${OUTPUT:-""}"
                        fi
                done
                compopt -o nospace
index ef6c5beb4b0e0ce879486ea0fb26ee5e7406859d..855de1468d4a2937039428f962e0021eda1f1e0a 100644 (file)
@@ -49,7 +49,7 @@ _fdisk_module()
                        "
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 4988f198bfcf5f7c260b1949c86876ee825bf381..3639763b56e7c6217630413d7945f6b3e78572bc 100644 (file)
@@ -12,7 +12,7 @@ _fincore_module()
                        OUTPUT_ALL='PAGES SIZE FILE RES'
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 5583fbf6c5dce7e50a8ff06d6f9286fed7d1a18f..bdfa5de5ce4ffc2804587c8c97db2599ee5cb77d 100644 (file)
@@ -55,7 +55,7 @@ _findmnt_module()
 
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 7fee1d0ae25cad95c85f0f76abdbcaf9f285b409..b58d8de948cf355bf085a1c9e833456aa4cad061 100644 (file)
@@ -33,7 +33,7 @@ _losetup_module()
                                SIZELIMIT DIO"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index ffe44b7d1f4c70aee0b56f633fa3dd485a2f82d7..a40fe428603f8d2b39e8654e125f73deea3df53e 100644 (file)
@@ -35,7 +35,7 @@ _lsipc_module()
                        "
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 4ca1e6b6e561041fee71aa9f4dac8ae03aee9480..acc7b1ff6d59ec9b12b52c166d0aea2b11876b6a 100644 (file)
@@ -20,7 +20,7 @@ _lslocks_module()
                        OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 85cf3e01a6352fce9ad26116ce28843f5c167eed..8f7a46ec30af665887b371d0bebd937397e46b0b 100644 (file)
@@ -12,7 +12,7 @@ _lsmem_module()
                        OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE'
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 929000013c1f8f409e38cf67aee28a0c9c025c01..2368336edd9cd62c0d269d1e89df23f05bfda06a 100644 (file)
@@ -15,7 +15,7 @@ _partx_module()
                        prefix="${cur%$realcur}"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index fff7a85c529118fcbc72a790d673d506d7c0089d..f5e00bb167cab1f0bbf34fed848858801e64d501 100644 (file)
@@ -17,7 +17,7 @@ _prlimit_module()
                        OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index c00e8c799b6d04afd3aa1665fe120274192659bc..9401f89ac04b86a2b2cee8e0458ae3e07e3cbd40 100644 (file)
@@ -28,7 +28,7 @@ _sfdisk_module()
                        "
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index fc80af5eb7aea37b9ebe3ec57dd28cd24c15328b..4a53ec5acaf774cc993ef2e3172e30269c4a038d 100644 (file)
@@ -18,7 +18,7 @@ _swapon_module()
                        OUTPUT_ALL="NAME TYPE SIZE USED PRIO UUID LABEL"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 811b5e3ccb2ccf2e7062459c9ff43bded68ee950..f1a870ef6950ab11c78f8d3c1d39e26cb8e08332 100644 (file)
@@ -29,7 +29,7 @@ _wdctl_module()
                        OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace
index 8c7767ce02e27983f3c1fb7fae2b824478044e3d..672d8102ad3db22e97e7e64055b9fe4b1aea4515 100644 (file)
@@ -18,7 +18,7 @@ _zramctl_module()
                                MIGRATED MOUNTPOINT"
                        for WORD in $OUTPUT_ALL; do
                                if ! [[ $prefix == *"$WORD"* ]]; then
-                                       OUTPUT="$WORD $OUTPUT"
+                                       OUTPUT="$WORD ${OUTPUT:-""}"
                                fi
                        done
                        compopt -o nospace