Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Usage:
- # Download this file
- # Put it in /bin or wherever you want, eg: /bin/tmuxlogin
- # Give it excutable permission, eg: sudo chmod +x /bin/tmuxlogin
- # Modify your /etc/shells and add /bin/tmuxlogin to it
- # chsh -s /bin/tmuxlogin
- # Done!
- # Define colors
- YELLOW="\033[0;93m"
- GREEN="\033[0;32m"
- CYAN="\033[0;36m"
- RED="\033[0;31m"
- NC="\033[0m"
- # Do not attach when using a local terminal emulator or tty
- if [ "$SSH_CLIENT" == "" ]; then
- /usr/bin/tmux new
- exit $?
- fi
- # Switch to bash when there's arguments exist
- # such as `scp' or `sftp' or `ssh -t'
- if [ "$1" != "" ]; then
- exec -l /bin/bash "-bash" "$@"
- fi
- # Add a pause for displaying motd
- echo -e "\n$GREEN[ Press any key to continue ]\n$YELLOW"
- read -n 1 -s -r
- /usr/bin/tmux attach || /usr/bin/tmux new
- EXITSTATUS=$?
- echo -e $NC
- exit $EXITSTATUS
Add Comment
Please, Sign In to add comment