fixes #343 by surrounding $HOME (which can have spaces) with quotations marks
This commit is contained in:
@@ -13,14 +13,14 @@ _sshcomplete() {
|
||||
|
||||
|
||||
# parse all defined hosts from .ssh/config
|
||||
if [ -r $HOME/.ssh/config ]; then
|
||||
COMPREPLY=($(compgen -W "$(grep ^Host $HOME/.ssh/config | awk '{print $2}' )" ${OPTIONS}) )
|
||||
if [ -r "$HOME/.ssh/config" ]; then
|
||||
COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{print $2}' )" ${OPTIONS}) )
|
||||
fi
|
||||
|
||||
# parse all hosts found in .ssh/known_hosts
|
||||
if [ -r $HOME/.ssh/known_hosts ]; then
|
||||
if grep -v -q -e '^ ssh-rsa' $HOME/.ssh/known_hosts ; then
|
||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
|
||||
if [ -r "$HOME/.ssh/known_hosts" ]; then
|
||||
if grep -v -q -e '^ ssh-rsa' "$HOME/.ssh/known_hosts" ; then
|
||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' "$HOME/.ssh/known_hosts" | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user