Skip to content

Instantly share code, notes, and snippets.

@ivan4th
Created November 18, 2015 10:21
Show Gist options
  • Save ivan4th/1dd225a77552a9a6593b to your computer and use it in GitHub Desktop.
Save ivan4th/1dd225a77552a9a6593b to your computer and use it in GitHub Desktop.
.ssh/config.d support
# http://code-and-hacks.peculier.com/articles/setting-terminal-title-in-gnu-screen/
function settitle () {
if [ "$TERM" != "screen" ]; then
return
fi
if [ -n "$STY" ] ; then
# We are in a screen session
# echo "Setting screen titles to $@"
printf "\033k%s\033\\" "$@"
# screen -X eval "at \\# title $@" "shelltitle $@"
else
printf "\033]0;%s\007" "$@"
fi
}
alias n='settitle b'
# rebuild ssh config
ussh () {
(echo "# GENERATED FILE!!!!! DO NOT EDIT!!!!!"; cat ~/.ssh/config.d/*) >~/.ssh/config
}
ussh
grep '^ *Host .*#CMD' ~/.ssh/config |
sed 's/^Host *\| *#.*//g' |
while read h; do
echo "alias $h='settitle $h; ssh $h'"
done >~/.ssh/aliases
. ~/.ssh/aliases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment