Search code examples
linuxbashterminalgnome-terminal

Prevent Gnome Terminal From Exiting After Execution


How do you prevent gnome-terminal from exiting after its given command has exited?

I'm calling gnome-terminal from a cronjob, in order to create a terminal accessible to the user. The terminal is initially given a specific program to run. e.g.

gnome-terminal --tab -e "/usr/bin/myprog"

This works fine, except that when "myprog" exits, so does the gnome-terminal. How do I keep it running, but just drop back to a terminal prompt?


Solution

  • Try this:

    gnome-terminal --tab -- "/bin/bash -c '/usr/bin/myprog; exec /bin/bash -i'"