Skip to content

Instantly share code, notes, and snippets.

@yunusemreayhan
Created March 12, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yunusemreayhan/207f4d7b94c162c86a29ca5d3f6b0ad3 to your computer and use it in GitHub Desktop.
Save yunusemreayhan/207f4d7b94c162c86a29ca5d3f6b0ad3 to your computer and use it in GitHub Desktop.
example tmux configuration
#!/bin/bash
tmux start-server
tmux new-session -d -s dummy
for var in "$@"
do
m_current_env=$var
m_current_session_name=$m_current_env
tmux has-session -t $m_current_session_name
if (( $? )) ; then
tmux new-session -d -s $m_current_session_name -n "$m_current_env"m
tmux selectp -t 1
tmux send-keys "some session command 0" C-m
tmux new-window -t $m_current_session_name:1 -n "$m_current_env"l
tmux selectp -t 2
tmux send-keys "some session command 1" C-m
tmux new-window -t $m_current_session_name:2 -n "$m_current_env"c
tmux selectp -t 3
tmux send-keys "some session command 2" C-m
tmux new-window -t $m_current_session_name:3 -n "$m_current_env"a
tmux selectp -t 4
tmux send-keys "some session command 3" C-m
else
echo "$m_current_session_name already exist"
fi
done
tmux attach-session -t $m_current_session_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment