0

I commonly need to run a specific screen session with 9-10 windows, most of which need to run either an interactive command, or simply a setup-type of command.

I do this via screen -c <config-that-specifies-ttys-and-commands>

The pseudo-code for my tty / command management looks like this:

screen -t foo_title <interactive_cmd_to_start_automatically>
screen -t bar_title <a_different_cmd_to_launchh>
... etc ...

The problem I am having is that, periodically, I need to stop these interactive commands, DROPPING TO A SHELL IN THE SAME TTY, doing some troubleshooting, then manually re-starting the command. Screen will have no problems running these commands, but once they complete, screen kills off that window / tty. (To try it out, just specify something like 'top' as the command to run. When you exit top, list your screen windows with Ctrl-A ". You'll see your top tty has totally vanished)

So my questions, in order: - Does screen support a native way to get your normal shell prompt after the command finishes, in the same TTY? - If so, how? - If not (which I think is the case), what's the cleanest way to invoke a shell, from the screen config, after said command finishes so that you still get the TTY and a shell prompt?

Thanks!!!

0

A simple solution is to run your command, then the shell, as a shell command, eg:

screen -t title  bash -c 'top; exec bash -i'

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.