Created
May 31, 2012 17:16
-
-
Save mgedmin/2844839 to your computer and use it in GitHub Desktop.
.bashrc snippet to remind me about running screen/tmux sessions
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
# check for screen sessions | |
if [ -d /var/run/screen/S-$USER/ ]; then | |
n=$(find /var/run/screen/S-$USER/ -type p|wc -l) | |
if [ $n -gt 0 ]; then | |
test x"$TERM" = xscreen && test -n "$WINDOW" \ | |
&& echo "You have $n active screen sessions (and this is one of them)." \ | |
|| echo "You have $n active screen sessions." | |
fi | |
fi | |
# check for tmux sessions | |
if [ -x /usr/bin/tmux ]; then | |
n=$(tmux list-sessions 2>/dev/null|wc -l) | |
if [ $n -gt 0 ]; then | |
test x"$TERM" = xscreen && test -n "$TMUX" \ | |
&& echo "You have $n active tmux sessions (and this is one of them)." \ | |
|| echo "You have $n active tmux sessions." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now maintained at https://github.com/mgedmin/dotfiles/blob/master/bashrc.screen (but I don't anticipate changes).