Created
May 27, 2014 23:50
-
-
Save donjohnson/36183f5b87a243ec2249 to your computer and use it in GitHub Desktop.
Change iterm2 (test build) window profile on ssh connect, and ssh bash autocompletion
This file contains hidden or 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
# SSH CONFIG | |
PermitLocalCommand yes | |
############ prod | |
Host saltmaster | |
HostName ec2-xx-xx-xxx-x.us-west-1.compute.amazonaws.com | |
User ec2-user | |
LocalCommand echo -e "\033]50;SetProfile=Salt Master\a"; | |
# bash autocomplete for ssh config Hosts: | |
_ssh () | |
{ | |
local cur prev opts; | |
COMPREPLY=(); | |
cur="${COMP_WORDS[COMP_CWORD]}"; | |
prev="${COMP_WORDS[COMP_CWORD-1]}"; | |
opts="`grep "Host " ~/.ssh/config|grep -v "\*"|cut -f2 -d' '`"; | |
if [[ ${cur} == * ]]; then | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})); | |
return 0; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I currently am working in a fairly tedious small-scale environment and having a fully populated ssh config file with hostnames is more beneficial than cumbersome for now. Hope someone else can use this!