This isn't about getting help with a bash script; this is about configuring your specific terminal for how you want it to behave. By default, the terminal closes after you choose to "Run in Terminal" a script. You can probably configure your terminal to not close after running a script that way. Depends on the terminal you use, and as you have given us zero information about your installation we can't help with any specifics. On Cinnamon you can configure the default Terminal through its Edit > Profile Preferences menu, the Title and Command tab, there set "When command exits" to what you want.
If you have a terminal without a menu, right-click inside the terminal and select to show the menubar.
Alternatively, if you want to change it only for this one bash script, put the following at the top of your bash script:
- Code: Select all
# if the script was not launched from a terminal, restart it from a terminal
if [[ ! -t 0 && -x /usr/bin/x-terminal-emulator ]]; then
/usr/bin/x-terminal-emulator -e "bash -c \"$0 $*; read -s -p 'Press enter to continue...'\""
Then start it with "Run" instead of "Run in Terminal", and it will ask for you to press the enter key before closing the terminal after the script completes. So this doesn't need above change to the terminal's settings.