1

I'm fiddling with tmux, trying to make it approximate the behavior I've had screen set up for to meet my quite modest terminal needs (I'm no programmer).

I just want it to start a couple of Bash sessions, and one instance of Alpine and one of Newsbeuter. I'm most of the way there, the main problem now being invoking a Python program in one of the Bash sessions at start-up.

The problem is that the Bash session wants to close after the Python program starts, whereas I want the Bash session to remain open so as to get STDOUT output from the Python program in that session.

To do that in screen, I just put the line:

$ screen -t bash1 python2.6 python-prog/prog.py &

NOTE: along with similar lines for the other 3 terminals I want to open on start-up) in .screenrc.

But when I put what seems to me the equivalent in .tmux.conf, i.e., neww -n Bash1 bash python2.6 python-prog/prog.py &, the Bash session in which the Python program was run, closes. Meantime, the other 3 terminals start fine under tmux and remain open.

So, what am I doing wrong here? How can I run that python program and get the bash session to remain open and displaying STDOUT output?

  • man tmux | less -p remain-on-exit – jasonwryan Sep 24 '14 at 3:12
2

Try splitting the command into two lines in your .tmux.conf

  1. Open the window

    neww -n Bash1 bash
    
  2. Send the command to the window

    send-keys -t "Bash1" 'python2.6 python-prog/prog.py' Enter
    
  • Thank you very much. Yes, that did do the trick. I've been searching all day and could not puzzle out on my own how to do this. – bleepy Sep 24 '14 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.