Prevent Gnome Terminal From Exiting After Execution
Try this:
gnome-terminal --tab -- "/bin/bash -c '/usr/bin/myprog; exec /bin/bash -i'"
How do I use python -i 'script.py' without closing terminal window after quitting interpreter?
As per your comment, you launch the gnome-terminal
with python as the main process. Per default, gnome-terminal
closes itself, if the shell process, in your case python
, exits. You have two options.
Modify the beahviour of gnome-terminal
In the settings for gnome-terminal
navigate to your used profile (left sidebar), then to the 4th tab (named something like Command). In the bottom drowpdown menu (named something like When command exits) you can set gnome-terminal to keep running when the command exits.
However, this is most likely not what you want, since you'll be left with a non-functional terminal window without a running shell.
Wrap your command in a shell process
If you want an interactive shell after python exits, you need to start one in the first place. To make it fall back to a shell, you can tell it to execute the shell again, after python exits:
gnome-terminal --full-screen -- /bin/bash -c "python3 -i path/to/script.py; bash"
See also: How to invoke bash, run commands inside the new shell, and then give control back to user?
Bash: Script Calling Gnome Terminal Leads To Child Process Error?
-x
and --command
are incorrect/obsolete options, try this :
sudo gnome-terminal --window --wait --tab --active --geometry=120X60 \
--title="$1" --working-directory="$code_directory" -- "$file_path"
To keep the terminal window open :
sudo gnome-terminal --window --wait --tab --active --geometry=120X60 \
--title="$1" --working-directory="$code_directory"\
-- bash -c "$file_path; exec bash"
Related Topics
How to Calculate CPU Utilization of a Process & All Its Child Processes in Linux
How to Pass Parameters to a Bash Script
How to Pass Argument with Exclamation Mark on Linux
Syntax Error Near Unexpected Token 'Then'
Write a Bash Shell Script That Consumes a Constant Amount of Ram for a User Defined Time
How to Force Abort on "Glibc Detected *** Free(): Invalid Pointer"
How to Use Gdb in Eclipse for C/C++ Debugging
How to Convert Linux 32-Bit Gcc Inline Assembly to 64-Bit Code
Openshift: "Failed to Execute Control Start" on Node Application
Awk - How to Delete First Column with Field Separator
Symbols from Convenience Library Not Getting Exported in Executable
Hardware Cache Events and Perf
What Are the Rules for Valid Identifiers (E.G. Functions, Vars, etc) in Bash
Docker: Are Docker Links Deprecated