@@ -905,8 +905,8 @@ _parse_usage()
905905# @param $1 prefix
906906_signals ()
907907{
908- local -a sigs=($( compgen -P " $1 " -A signal " SIG${cur# $1 } " ) )
909- COMPREPLY+=(" ${sigs[@]/# ${1} SIG/ ${1} } " )
908+ local -a sigs=($( compgen -P " ${1-} " -A signal " SIG${cur# ${1-} } " ) )
909+ COMPREPLY+=(" ${sigs[@]/# ${1- } SIG/ ${1- } } " )
910910}
911911
912912# This function completes on known mac addresses
@@ -1134,7 +1134,7 @@ _expand()
11341134 _pnames ()
11351135{
11361136 local -a procs
1137- if [[ $1 == -s ]]; then
1137+ if [[ ${1-} == -s ]]; then
11381138 procs=($( command ps axo comm | command sed -e 1d) )
11391139 else
11401140 local line i=-1 ifs=$IFS
@@ -1317,7 +1317,7 @@ _usergroup()
13171317 prefix=${cur%%* ([^:])}
13181318 prefix=${prefix// \\ / }
13191319 local mycur=" ${cur#* [:]} "
1320- if [[ $1 == -u ]]; then
1320+ if [[ ${1-} == -u ]]; then
13211321 _allowed_groups " $mycur "
13221322 else
13231323 local IFS=$' \n '
@@ -1329,7 +1329,7 @@ _usergroup()
13291329 # Reply with a list of unprefixed groups since readline with split on :
13301330 # and only replace the 'gr' part
13311331 local mycur=" ${cur#*: } "
1332- if [[ $1 == -u ]]; then
1332+ if [[ ${1-} == -u ]]; then
13331333 _allowed_groups " $mycur "
13341334 else
13351335 local IFS=$' \n '
@@ -1341,7 +1341,7 @@ _usergroup()
13411341 # Don't suffix with a : because readline will escape it and add a
13421342 # slash. It's better to complete into 'chown username ' than 'chown
13431343 # username\:'.
1344- if [[ $1 == -u ]]; then
1344+ if [[ ${1-} == -u ]]; then
13451345 _allowed_users " $cur "
13461346 else
13471347 local IFS=$' \n '
@@ -1697,6 +1697,7 @@ _known_hosts_real()
16971697 # https://man.openbsd.org/sshd.8#SSH_KNOWN_HOSTS_FILE_FORMAT
16981698 for i in " ${kh[@]} " ; do
16991699 while read -ra tmpkh; do
1700+ (( ${# tmpkh[@]} == 0 )) && continue
17001701 set -- " ${tmpkh[@]} "
17011702 # Skip entries starting with | (hashed) and # (comment)
17021703 [[ $1 == [\|\# ]* ]] && continue
@@ -1747,7 +1748,7 @@ _known_hosts_real()
17471748 fi
17481749
17491750 # Add hosts reported by avahi-browse, if desired and it's available.
1750- if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI: - } ]] &&
1751+ if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI-} ]] &&
17511752 type avahi-browse & > /dev/null; then
17521753 # The original call to avahi-browse also had "-k", to avoid lookups
17531754 # into avahi's services DB. We don't need the name of the service, and
@@ -2009,7 +2010,7 @@ _longopt()
20092010 [[ $line =~ --[-A-Za-z0-9]+= ? ]] &&
20102011 printf ' %s\n' ${BASH_REMATCH[0]}
20112012 done)" -- " $cur " ))
2012- [[ $COMPREPLY == *= ]] && compopt -o nospace
2013+ [[ ${ COMPREPLY-} == *= ]] && compopt -o nospace
20132014 elif [[ $1 == *@(rmdir|chroot) ]]; then
20142015 _filedir -d
20152016 else
0 commit comments