Skip to content

Instantly share code, notes, and snippets.

@chuyeow
Created April 6, 2020 03:17
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 chuyeow/128e770580178b7785cadad0d27da906 to your computer and use it in GitHub Desktop.
Save chuyeow/128e770580178b7785cadad0d27da906 to your computer and use it in GitHub Desktop.
Tmux script example
#!/bin/sh
set -e
cd $GOPATH/src/code.in.spdigital.sg/sp-digital/platform-admin-portal
attach() {
[ -n "${TMUX:-}" ] &&
tmux switch-client -t '=platform-admin' ||
tmux attach-session -t '=platform-admin'
}
if tmux has-session -t '=platform-admin' 2> /dev/null; then
attach
exit 0
fi
tmux new-session -d -s platform-admin -n docker-compose
# tmux new-window -d -t '=platform-admin' -n docker-compose
tmux send-keys -t '=platform-admin:=docker-compose' 'make run' Enter
tmux new-window -d -t '=platform-admin' -n tests
tmux send-keys -t '=platform-admin:=tests' 'gst' Enter
attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment