Created
February 12, 2018 09:09
-
-
Save belltailjp/76f4024d451960ab42af013b5854a687 to your computer and use it in GitHub Desktop.
Force naming tmux session
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
if [ ! -z $TMUX ]; then | |
tmux show-options | grep "TMUX_NO_FORCE_NAME_SESSION" > /dev/null | |
if [ $? -ne 0 ]; then | |
SESSION_NAME=`tmux display-message -p '#S'` | |
echo $SESSION_NAME | grep "^[0-9]\+$" > /dev/null | |
if [ $? -eq 0 ]; then # Not named | |
/bin/echo -n "tmux session name: " | |
read NAME | |
if [ ! -z $NAME ]; then | |
tmux rename-session $NAME | |
else | |
tmux set-option update-environment TMUX_NO_FORCE_NAME_SESSION=1 | |
fi | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment