Guest User

Untitled

a guest
Dec 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Usage:
  4. # Download this file
  5. # Put it in /bin or wherever you want, eg: /bin/tmuxlogin
  6. # Give it excutable permission, eg: sudo chmod +x /bin/tmuxlogin
  7. # Modify your /etc/shells and add /bin/tmuxlogin to it
  8. # chsh -s /bin/tmuxlogin
  9. # Done!
  10.  
  11. # Define colors
  12. YELLOW="\033[0;93m"
  13. GREEN="\033[0;32m"
  14. CYAN="\033[0;36m"
  15. RED="\033[0;31m"
  16. NC="\033[0m"
  17.  
  18. # Do not attach when using a local terminal emulator or tty
  19. if [ "$SSH_CLIENT" == "" ]; then
  20. /usr/bin/tmux new
  21. exit $?
  22. fi
  23.  
  24. # Switch to bash when there's arguments exist
  25. # such as `scp' or `sftp' or `ssh -t'
  26. if [ "$1" != "" ]; then
  27. exec -l /bin/bash "-bash" "$@"
  28. fi
  29.  
  30. # Add a pause for displaying motd
  31. echo -e "\n$GREEN[ Press any key to continue ]\n$YELLOW"
  32. read -n 1 -s -r
  33. /usr/bin/tmux attach || /usr/bin/tmux new
  34. EXITSTATUS=$?
  35. echo -e $NC
  36. exit $EXITSTATUS
Add Comment
Please, Sign In to add comment