Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Gnome Terminal From Exiting After Execution [duplicate]

Tags:

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?

like image 208
Cerin Avatar asked Dec 16 '10 22:12

Cerin


People also ask

How to keep GNOME Terminal open?

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.

How do I change GNOME Terminal settings?

To configure GNOME terminal, go to Edit > Preferences. From here, you can configure some global and profile specific settings of GNOME Terminal.

How do I stop a bash script from closing?

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.


1 Answers

Try this:

gnome-terminal --tab -e "/bin/bash -c '/usr/bin/myprog; exec /bin/bash -i'" 
like image 197
Dennis Williamson Avatar answered Sep 19 '22 06:09

Dennis Williamson