Fix macOS sed in SSH completion

See here for details: b5f666d467
This commit is contained in:
Nils Winkler
2020-01-23 08:36:53 +01:00
committed by GitHub
parent e8b42c4687
commit d8d6109e43

View File

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