Corrects the inclusion file list by properly interpreting the paths specified in the Include directive of the ssh_config, aka paths relative to the ~/.ssh folder.

pull/1474/head
Damien MASCRÉ 2020-01-07 13:20:01 +01:00
parent cfa94e70fa
commit b5f666d467
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ _sshcomplete() {
for fl in "$HOME/.ssh/config" \ for fl in "$HOME/.ssh/config" \
$(grep "^\s*Include" "$HOME/.ssh/config" | $(grep "^\s*Include" "$HOME/.ssh/config" |
awk '{for (i=2; i<=NF; i++) print $i}' | awk '{for (i=2; i<=NF; i++) print $i}' |
sed "s|^~/|$HOME/|") sed -re "s|^([^/~])|$HOME/.ssh/\1|" -e "s|^~/|$HOME/|")
do do
if [ -r "$fl" ]; then if [ -r "$fl" ]; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) ) COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )