From d85b6e67f0198998657a71b14e86300a4cad8a11 Mon Sep 17 00:00:00 2001 From: Levent YALCIN Date: Tue, 15 Nov 2016 22:21:04 +0000 Subject: [PATCH] scp should have completion too --- completion/available/ssh.completion.bash | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index 1ab08000..a411f64a 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -11,7 +11,7 @@ _sshcomplete() { local OPTIONS=" -- ${CURRENT_PROMPT}" fi - + # parse all defined hosts from .ssh/config if [ -r "$HOME/.ssh/config" ]; then COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) ) @@ -28,9 +28,8 @@ _sshcomplete() { if [ -r /etc/hosts ]; then COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) ) fi - + return 0 } -complete -o default -o nospace -F _sshcomplete ssh - +complete -o default -o nospace -F _sshcomplete ssh scp