Bash – Tmux – Get number of panes in the current window in bash variable

bashtmux

I'm scripting Tmux, and would like to know the number of panes in the current window from a bash script.

Is there anyway to find out this information?

in pseudo code, i'd like something like this:

#!/bin/bash
COUNT=$(tmux get_number_of_panes)
...

Best Answer

Might be a better way, but

tmux list-panes | wc -l

works.

Related Question