My favorite BASH shell completion of all time is hostname completion for all of my favorite commands:
SSH_COMPLETE=( $(cat ~/.ssh/known_hosts | \
cut -f 1 -d ‘ ‘ | \
sed -e s/,.*//g | \
uniq | \
egrep -v [0123456789]) )complete -o default -W “${SSH_COMPLETE[*]}” ssh scp sftp rsync nmap traceroute ping nslookup dig host nmap nc
I find most of the hosts I ssh into I use for basic network diagnostics. So performing completion for traceroute, ping, etc based on the contents of known_hosts works great. Just add it to your .bashrc.
Update: 2008/11/04
I’ve modified it to support completion of SVN commands leveraging the hostnames expanded during the SSH completion above:
SVN_COMPLETE=( $(svn -h|grep -e '^ '|awk '{ print $1; }') $SSH_COMPLETE )
complete -o default -W "${SVN_COMPLETE[*]} ${SSH_COMPLETE[*]}" svn
Adding these may lengthen your shell exec tasks.
I test at work. I work from home. But I will not test from home. Fix it yourself. (trademark pending).
Feed
Comment by Bobby
#1 Saturday, October 25, 2008, 12:31 am o'clock |
Yo Spence. Seriously man, what language do you speak these days. Just kidding man. Really dude, hit me up sometime. Just got in touch with Collier down in Costa Rica. But maybe someday you will join that joe the plumber facebook someday. Anyways, hope life is going okay for ya. Peace man.
bobbo
meachamrob@netscape.net
Comment by spencer
#2 Saturday, October 25, 2008, 7:40 am o'clock |
Bob-o I’m going to have to introduce you to email one day. My address is all over this site