Created
April 11, 2012 07:57
-
-
Save fieg/2357723 to your computer and use it in GitHub Desktop.
.bash_profile for OSX including autocomplete for ssh hosts, default variables and some aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/sbin:$PATH | |
export EDITOR=vim | |
export APPLICATION_ENV="development" | |
export CLICOLOR=1 | |
export LSCOLORS=dxfxcxdxbxegedabagacad | |
alias composer="php /usr/local/bin/composer.phar" | |
_complete_ssh_hosts () | |
{ | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
cut -f 1 -d ' ' | \ | |
sed -e s/,.*//g | \ | |
grep -v ^# | \ | |
uniq | \ | |
grep -v "\[" ; | |
cat ~/.ssh/config | \ | |
grep "^Host " | \ | |
awk '{print $2}' | |
` | |
COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur)) | |
return 0 | |
} | |
complete -F _complete_ssh_hosts ssh |
Changed cat ~/.ssh/config --> ~/.ssh/known_host as I don't have ~/.ssh/config file.
Now it works perfectly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My /.bash_profile looks as follows:
And it does not work for me??
I have entries in both config and known_hosts