Created
May 28, 2017 23:32
-
-
Save 6d61726b760a/85e46c305f3bb5c8606274f03a40e66c to your computer and use it in GitHub Desktop.
start an ssh session in a new tmux window
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
#!/bin/bash | |
if [ $# -eq 0 ] || [ $# -gt 1 ]; | |
then | |
echo "usage: r [username]@hostname" | |
exit | |
fi | |
input="$*" | |
case "$*" in | |
*\@*) | |
user="${input%%\@*}" | |
host="${input##*@}" | |
tmux new-window -n "${host}" ssh "${user}@${host}" | |
;; | |
*) | |
host="${input}" | |
tmux new-window -n ${host} ssh "${host}" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment