Skip to content

Instantly share code, notes, and snippets.

@selivan
Created September 1, 2019 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selivan/dcbc5183b9fd62afc842e47476b0fcfb to your computer and use it in GitHub Desktop.
Save selivan/dcbc5183b9fd62afc842e47476b0fcfb to your computer and use it in GitHub Desktop.
# change shell title before running ssh
function ssh() {
# mess with title only if shell is interactive
# .bashrc should have a guard against non-interactive execution
# so this is just for additional safety - not good idea to break ssh
if [[ $- == *i* ]]; then
local host=$(echo "$@" | sed 's/-[a-zA-Z] //' | tr -d ' ' | cut -d' ' -f1)
echo -ne "\033]0;$host\007"
fi
$(type -f -p ssh || echo /usr/bin/ssh) "$@"
}
alias vpnjob='echo -ne "\033]0;vpn\007" ; sudo /usr/sbin/openvpn --config "$HOME"/work/job/vpn/my.ovpn'
#test -n "$TMOUT" && exec sh -c "unset TMOUT; exec bash"
#alias fuckoff='exec sh -c "unset TMOUT; exec bash"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment