Brian's Waste of Time

Mon, 07 Feb 2005

Bash Completion for SSH

Cleaned up my bash commpletion for ssh some, figured I'd put it up so can people can show me what they have that's better ;-)

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

You can drop the final egrep -v [0123456789] if you regularly ssh to ip addresses =)

3 writebacks [/tech] permanent link