Created
April 6, 2017 15:56
-
-
Save webee/31ff27df0ff5b4c8565d00d9a67dbb23 to your computer and use it in GitHub Desktop.
mytmux.sh
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
#!/bin/bash | |
if [ "$1" == '.' ];then | |
shift; | |
exec tmux $* | |
exit 0 | |
fi | |
name=$1 | |
n=$2 | |
if [ "$name" == "" ];then | |
name="work" | |
fi | |
if tmux ls|grep -q "^$name";then | |
tmux attach-session -t $name | |
exit 0 | |
fi | |
if [ "$n" == "" ];then | |
n=4 | |
fi | |
tmux new-session -s $name -d | |
while [ $n -gt 1 ];do | |
tmux neww -t $name | |
n=$[$n-1] | |
done | |
tmux next-window -t $name | |
tmux attach-session -t $name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment