Skip to content

Instantly share code, notes, and snippets.

@webee
Created April 6, 2017 15:56
Show Gist options
  • Save webee/31ff27df0ff5b4c8565d00d9a67dbb23 to your computer and use it in GitHub Desktop.
Save webee/31ff27df0ff5b4c8565d00d9a67dbb23 to your computer and use it in GitHub Desktop.
mytmux.sh
#!/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