From fecb8c6115f5ca3d1ff4656dd8a07274945ed797 Mon Sep 17 00:00:00 2001 From: Emil Bay Date: Sat, 18 Oct 2014 20:37:10 +0200 Subject: .bash_profile: Support multiple hosts in SSH completion Useful in cases such as: ``` Host vm1 vm2 vm3 vm4 Host localhost # ... ``` Simply adding a `-` to `tr` fixes this. Closes #437. --- .bash_profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bash_profile b/.bash_profile index 3f824a0..daa7552 100644 --- a/.bash_profile +++ b/.bash_profile @@ -38,7 +38,7 @@ if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completio fi; # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards -[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh; +[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; # Add tab completion for `defaults read|write NSGlobalDomain` # You could just use `-g` instead, but I like being explicit -- cgit v1.2.3