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?
Keeping the gnome-terminal Open For the first time, with option -c, just to run a sequence of commands in a new shell. Subsequently, the nested bash -i opens an interactive shell for us. As a result, the terminal stays open.
To configure GNOME terminal, go to Edit > Preferences. From here, you can configure some global and profile specific settings of GNOME Terminal.
To terminate the script in case of an error, we can use the “-e” option. and the script exits on an error, it closes the terminal window.
Try this:
gnome-terminal --tab -e "/bin/bash -c '/usr/bin/myprog; exec /bin/bash -i'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With