Re:Scripting tmux
by GordonS on Saturday January 04, 2020 @06:21AM
(#21954280)
Nice, I had no idea you could script tmux like that! Reminds me of "expect", which I've used to automate interactive SSH sessions with network devices.
[ Parent
| on HN ]
Replacing the sleeps with calls to "tmux capture-pane" to parse the responses would be closer to expect.
Brainless method I use to check the panel:
case $1 in
""|-b|-E|-S|-t)
tmux capturep $@ --;
tmux showb $@ --;
exec tmux dele --;
esac
Also there is a "-N repeat count" option for send-keys in newer versions of tmux.
Re:Scripting tmux
by abcdef123xyz2 on Sunday January 05, 2020 @03:26PM
(#21963802)
capture-pane has -p so you can pipe its output rather than letting it create a buffer you have to delete.