Bash script on my desktop, 2x Click, select 'Run in Terminal', gnome-terminal opens and script runs. The last item executed is a python script that runs forever and occasionally displays things. If I Ctrl-C kill it then the terminal closes. Instead I want the terminal to stay open (drop to a shell prompt) because sometimes I modify the python script, Ctrl-C it, then re-launch it.
Alternatively I tried having my bash script launch a new terminal window for the Python script but got the same result in that I was unable to keep that terminal window from closing once the python script is killed. I searched it up and tried many things, I can't recall them all.
I also tried having the bash script launch a terminal window then use xdotool to send keys to launch the python script but the keys never hit the terminal, I think for security reasons.
Any suggestions?
Keep terminal open after bash script launch from desktop
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
-
- Level 1
- Posts: 21
- Joined: Wed Dec 09, 2020 11:59 am
Keep terminal open after bash script launch from desktop
Last edited by LockBot on Mon Aug 07, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Keep terminal open after bash script launch from desktop
Ending your script with command
bash
should keep it open although you would really be in a child process of the shell where you started in.If you think the issue is solved, edit your original post and add the word solved to the title.
Re: Keep terminal open after bash script launch from desktop
So use
exec bash
, that replaces the running shell with the command to execute — it this case an interactive shell.Re: Keep terminal open after bash script launch from desktop
A note; poster talks about ending the script with here Ctrl-C, i.e., before it ever gets to either a
bash
or exec bash
. Currently on Xfce and I don't see such available in its configuration but if not mistaken then gnome-terminal has or at least once had a "keep terminal open after program exits" switch somewhere.Re: Keep terminal open after bash script launch from desktop
It's a bash script that launches a Python script. The Ctrl+C should interrupt the Python script, returning control to the bash script. So doing a exec bash after the Python script invocation should work.
Re: Keep terminal open after bash script launch from desktop
Sure. In any case I suggest checking your terminal options; Cinnamon uses gnome-terminal.
Re: Keep terminal open after bash script launch from desktop
In mate there is such an option in the terminal profile setting, but it doesn't seem to make any difference.if not mistaken then gnome-terminal has or at least once had a "keep terminal open after program exits" switch somewhere.
If you think the issue is solved, edit your original post and add the word solved to the title.
Re: Keep terminal open after bash script launch from desktop
Then that's yet another instance where I might as well have not noted such...
Re: Keep terminal open after bash script launch from desktop
Well it does make a difference but not the difference you want.
If you think the issue is solved, edit your original post and add the word solved to the title.