- redirect stderr to /dev/null when performing remote path completion for
scp - factor out the scp ls completion code into its own function, as we need to call this once remotely and once locally
This commit is contained in:
parent
9ae4341c37
commit
0026a9cb0b
@ -1,6 +1,6 @@
|
||||
# bash_completion - some programmable completion functions for bash 2.05b
|
||||
#
|
||||
# $Id: bash_completion,v 1.450 2002/10/20 06:56:41 ianmacd Exp $
|
||||
# $Id: bash_completion,v 1.451 2002/10/20 22:11:21 ianmacd Exp $
|
||||
#
|
||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||
#
|
||||
@ -1918,6 +1918,14 @@ _ssh()
|
||||
}
|
||||
shopt -u hostcomplete && complete -F _ssh ssh slogin sftp
|
||||
|
||||
_scp_filedir()
|
||||
{
|
||||
# do not indent last line of this function
|
||||
ls -aF1d "$path*" 2>/dev/null | sed -e 's/ /\\\\\\\ /g' \
|
||||
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e 's/\
|
||||
//g'
|
||||
}
|
||||
|
||||
# scp(1) completion
|
||||
#
|
||||
_scp()
|
||||
@ -1944,16 +1952,12 @@ _scp()
|
||||
# escape spaces; remove executables, aliases, pipes and sockets;
|
||||
# add space at end of file names; change newlines into spaces
|
||||
COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
|
||||
ls -aF1d "$path*" | sed -e 's/ /\\\\\\\ /g' \
|
||||
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' \
|
||||
-e 's/\
|
||||
//g' ) )
|
||||
|
||||
$(declare -f _scp_filedir | sed -e '1,2d; 5d')))
|
||||
return 0
|
||||
fi
|
||||
|
||||
[[ "$cur" == */* ]] || _known_hosts -c -a
|
||||
_filedir
|
||||
COMPREPLY=( ${COMPREPLY[@]} $( _scp_filedir ) )
|
||||
|
||||
return 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user