I was playing with an script that sends text to a tmux stdin after this answer (https://unix.stackexchange.com/a/773049/189571 by @Kamil Maciorowski) and I was wrongly doing this
tty=$(tmux new-session -d -s aux -PF "#{pane_tty}")
echo -n foo > $tty && tput cr > $tty && echo bar > $tty
tmux capture-pane -t aux -p -S0 -E3
which results in foo PROMPT %> bar
(undeterministically sequenced, and PROMPT is printed)
whereas the same but using command tail -f /dev/null
as an argument of tmux new-session, as Kamil suggested, gives bar
as result , which is what I expected
I would like to understand why without tail everything fails.
Isn't tail -f /dev/null
here sort of an sleep infinity
?
What's the difference with not passing any command?
I mean if you don't pass anything to new-session, the pane is kept alive until kill-session as well