Created
December 8, 2011 14:26
-
-
Save flashingpumpkin/1447125 to your computer and use it in GitHub Desktop.
Auto completing for some commands from your hosts file
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
#!/bin/bash | |
# Choose one | |
complete -W "$(grep -E '^[0-9]' /etc/hosts | awk '{ print $2 }')" ssh scp rsync ping | |
complete -W "$(grep -E '^ssh' ~/.bash_history | awk '{ print $2 }')" ssh scp rsync | |
complete -W "$(grep -E '^(\w)' ~/.ssh/known_hosts | awk '{ print $1 }' | sort -u | cut -d ',' -f 1)" ssh scp rsync ping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment