Add 'bash/tmux_launcher.bash'

This commit is contained in:
daryl
2022-05-26 13:55:02 +09:30
parent a610b46d84
commit 2a20a5a7f0

17
bash/tmux_launcher.bash Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
tmux new -s buildsw -d # create new session with a name and detach
tmux rename-window -t buildsw:0 "This is window foo." # rename (default) window 0 of foo to something cool
tmux split-window -t buildsw:0 -v -p 60 # split into top and bottom panes with 60/40 row split
tmux send-keys -t buildsw:0.0 'top' 'C-m' # run a thing in the top pane, can use 'C-m' or 'Enter'
tmux send-keys -t buildsw:0.1 'make all' 'C-m' # run another thing in the bottom pane
sleep 2 # wait for PID to get created and be available for use (Why is this needed?)
MYPID=`pgrep exec2`
tmux attach -t buildsw # jump into the active session to watch things happen
tail --pid=$MYPID -f /dev/null # funky thing tail can do - wait for process to finish!
tmux send-keys -t buildsw:0.0 'q' 'C-m' # tell 'top' in top pane to quit (C-m probably not needed here...)
tmux kill-session -t buildsw # close tmux session
# This mostly works, just doesn't seem to exit the session correctly.