From b04521698131ace8b78f7a86690d21beed8e828b Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Mon, 11 Feb 2002 02:14:08 +0000 Subject: [PATCH] _scp() now suffixes a ':' on hostnames --- bash_completion | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bash_completion b/bash_completion index bf6188ef..9ecfea96 100644 --- a/bash_completion +++ b/bash_completion @@ -1,8 +1,6 @@ # bash_completion - some programmable completion functions for bash 2.05a # -# # @@ -1048,10 +1046,11 @@ _chkconfig() # _known_hosts() { - local cur kh user + local cur kh user suffix COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} + [ "$1" = -c ] && suffix=':' [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@} kh=() @@ -1085,11 +1084,11 @@ _known_hosts() if ($i ~ /'$cur'/) {print $i} \ }}' ${kh[@]} ) ) for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do - COMPREPLY[i]=$user${COMPREPLY[i]} + COMPREPLY[i]=$user${COMPREPLY[i]}$suffix done else # Just do normal hostname completion - COMPREPLY=( $( compgen -A hostname $cur ) ) + COMPREPLY=( $( compgen -A hostname -S $suffix $cur ) ) fi return 0 @@ -1136,7 +1135,7 @@ _scp() _expand || return 0 - [[ "$cur" == */* ]] || _known_hosts + [[ "$cur" == */* ]] || _known_hosts -c _filedir return 0