Created
November 18, 2015 10:21
-
-
Save ivan4th/1dd225a77552a9a6593b to your computer and use it in GitHub Desktop.
.ssh/config.d support
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
# 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