@@ -302,7 +302,7 @@ _comp_cmd_ssh()
302302
303303 _comp_cmd_ssh__compgen_suboption_check "$1" && return
304304
305- local ipvx
305+ local ipvx=
306306
307307 # Keep cases sorted the same they're in ssh's usage message
308308 # (but do group ones with same arg completion)
@@ -459,7 +459,6 @@ _comp_cmd_sftp()
459459 shopt -u hostcomplete && complete -F _comp_cmd_sftp sftp
460460
461461# things we want to backslash escape in scp paths
462- # shellcheck disable=SC2089
463462_comp_cmd_scp__path_esc='[][(){}<>"'"'"',:;^&!$=?`\\|[:space:]]'
464463
465464# Complete remote files with ssh. Returns paths escaped with three backslashes
@@ -493,7 +492,6 @@ _comp_xfunc_scp_compgen_remote_files()
493492 local _path=${cur#*:}
494493
495494 # unescape (3 backslashes to 1 for chars we escaped)
496- # shellcheck disable=SC2090
497495 _path=$(command sed -e 's/\\\\\\\('"$_comp_cmd_scp__path_esc"'\)/\\\1/g' <<<"$_path")
498496
499497 # default to home dir of specified user on remote host
@@ -509,14 +507,12 @@ _comp_xfunc_scp_compgen_remote_files()
509507 local _files
510508 if [[ $_dirs_only ]]; then
511509 # escape problematic characters; remove non-dirs
512- # shellcheck disable=SC2090
513510 _files=$(ssh -o 'Batchmode yes' "$_userhost" \
514511 command ls -aF1dL "$_path*" 2>/dev/null |
515512 command sed -e 's/'"$_comp_cmd_scp__path_esc"'/'"$_escape_replacement"'/g' -e '/[^/]$/d')
516513 else
517514 # escape problematic characters; remove executables, aliases, pipes
518515 # and sockets; add space at end of file names
519- # shellcheck disable=SC2090
520516 _files=$(ssh -o 'Batchmode yes' "$_userhost" \
521517 command ls -aF1dL "$_path*" 2>/dev/null |
522518 command sed -e 's/[*@|=]$//g' \
@@ -539,26 +535,26 @@ _scp_remote_files()
539535# @since 2.12
540536_comp_xfunc_scp_compgen_local_files()
541537{
542- local _dirsonly =""
538+ local _dirs_only =""
543539 if [[ ${1-} == -d ]]; then
544- _dirsonly =set
540+ _dirs_only =set
545541 shift
546542 fi
547543
548544 local files
549545 _comp_expand_glob files '"$cur"*' || return 0
550- if [[ $_dirsonly ]]; then
551- _comp_compgen -RU files split -l -- "$(
546+ if [[ $_dirs_only ]]; then
547+ _comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
552548 command ls -aF1dL "${files[@]}" 2>/dev/null |
553549 command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
554- -e '/[^/]$/d' -e "s/^/${1-}/"
550+ -e '/[^/]$/d'
555551 )"
556552 else
557- _comp_compgen -RU files split -l -- "$(
553+ _comp_compgen -RU files split -l ${1:+-P "$1"} -- "$(
558554 command ls -aF1dL "${files[@]}" 2>/dev/null |
559555 command sed -e 's/[*@|=]$//g' \
560556 -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \
561- -e 's/[^/]$/& /g' -e "s/^/${1-}/"
557+ -e 's/[^/]$/& /g'
562558 )"
563559 fi
564560}
@@ -588,7 +584,7 @@ _comp_cmd_scp()
588584 return
589585 }
590586
591- local ipvx
587+ local ipvx=
592588
593589 case $prev in
594590 -*c)
@@ -640,7 +636,7 @@ _comp_cmd_scp()
640636 ;;
641637 esac
642638
643- local prefix
639+ local prefix=
644640
645641 if [[ $cur == -F* ]]; then
646642 cur=${cur#-F}
0 commit comments