bash-completion: fix few bash set -u issues

This is the same fix as in reference commit, and the same reason.  Just
correct few files missed earlier.

Reference: abbcec4fc9
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2018-04-05 20:56:53 +01:00 committed by Karel Zak
parent 7afdbb6f07
commit c6f0bdfecc
8 changed files with 13 additions and 13 deletions

View File

@ -12,7 +12,7 @@ _chcpu_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
CPULIST="$WORD $CPULIST"
CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace
@ -26,7 +26,7 @@ _chcpu_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
CPULIST="$WORD $CPULIST"
CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace

View File

@ -20,15 +20,15 @@ _lsblk_module()
prefix="${cur%$realcur}"
for I in /sys/dev/block/*; do
J=${I##*/}
MAJOR_ALL="$MAJOR_ALL ${J%%:*}"
MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}"
done
for WORD in $MAJOR_ALL; do
for WORD in ${MAJOR_ALL:-""}; do
if ! [[ $prefix == *"$WORD"* ]]; then
MAJOR="$WORD $MAJOR"
MAJOR="$WORD ${MAJOR:-""}"
fi
done
compopt -o nospace
COMPREPLY=( $(compgen -P "$prefix" -W "$MAJOR" -S ',' -- $realcur) )
COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) )
return 0
;;
'-o'|'--output')
@ -37,7 +37,7 @@ _lsblk_module()
prefix="${cur%$realcur}"
for WORD in $LSBLK_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
LSBLK_COLS="$WORD $LSBLK_COLS"
LSBLK_COLS="$WORD ${LSBLK_COLS:-""}"
fi
done
compopt -o nospace

View File

@ -15,7 +15,7 @@ _lscpu_module()
CONFIGURED ONLINE MAXMHZ MINMHZ"
for WORD in $OPTS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
OPTS="$WORD $OPTS"
OPTS="$WORD ${OPTS:-""}"
fi
done
compopt -o nospace

View File

@ -35,7 +35,7 @@ _lslogins_module()
prefix="${cur%$realcur}"
for WORD in $LSLOGINS_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
LSLOGINS_COLS="$WORD $LSLOGINS_COLS"
LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}"
fi
done
compopt -o nospace

View File

@ -14,7 +14,7 @@ _lsns_module()
prefix="${cur%$realcur}"
for WORD in $LSNS_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
LSNS_COLS="$WORD $LSNS_COLS"
LSNS_COLS="$WORD ${LSNS_COLS:-""}"
fi
done
compopt -o nospace

View File

@ -15,7 +15,7 @@ _mount_module()
prefix="${cur%$realcur}"
for WORD in $TYPES; do
if ! [[ $prefix == *"$WORD"* ]]; then
TYPE_COLS="$WORD $TYPE_COLS"
TYPE_COLS="$WORD ${TYPE_COLS:-""}"
fi
done
compopt -o nospace

View File

@ -38,7 +38,7 @@ _setpriv_module()
GIDS_ALL=$(getent group | awk -F: '{print $3}')
for WORD in $GIDS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
GIDS="$WORD $GIDS"
GIDS="$WORD ${GIDS:-""}"
fi
done
compopt -o nospace

View File

@ -12,7 +12,7 @@ _taskset_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
CPULIST="$WORD $CPULIST"
CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace