Last active
June 29, 2016 09:48
-
-
Save ssh0/34738ab37b6b64f28cba to your computer and use it in GitHub Desktop.
[tmux] 端末起動時に自動で新規セッションを作成 or 既存セッションにアタッチ ref: http://qiita.com/ssh0/items/a9956a74bff8254a606a
This file contains 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 [[ ! -n $TMUX && $- == *l* ]]; then | |
# get the IDs | |
ID="`tmux list-sessions`" | |
if [[ -z "$ID" ]]; then | |
tmux new-session | |
fi | |
create_new_session="Create New Session" | |
ID="$ID\n${create_new_session}:" | |
ID="`echo $ID | $PERCOL | cut -d: -f1`" | |
if [[ "$ID" = "${create_new_session}" ]]; then | |
tmux new-session | |
elif [[ -n "$ID" ]]; then | |
tmux attach-session -t "$ID" | |
else | |
: # Start terminal normally | |
fi | |
fi |
This file contains 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
main: 3 windows (created Wed Jan 27 11:49:33 2016) [88x34] (attached) | |
1: 1 windows (created Wed Jan 27 17:59:17 2016) [213x54] |
This file contains 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
$ zsh |
This file contains 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
$ echo $- | |
569XZghiklms |
This file contains 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
$ echo $- | |
569XZghikms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment