Linux Terminator终端:如何运行Bash脚本后不自动关闭
Hey there! I’ve dealt with this exact frustration before—Terminator closing right after your script runs is super annoying when you want to check output or keep working in that session. Here are a few straightforward solutions:
Option 1: Modify the Launch Command
Instead of running the script directly, wrap it in a command chain that starts an interactive Bash shell once the script completes. Use this command instead:
terminator -x sh -c "/home/test/test.sh; exec bash"
The exec bash part replaces the current shell with a new interactive one, keeping the Terminator window open indefinitely until you manually close it.
Option 2: Update Your Terminator Profile (Global Setting)
If you want all commands (not just this script) to leave the Terminator window open after finishing, adjust your profile settings:
- Right-click inside any Terminator window → Select Preferences
- Go to the Profiles tab and choose the profile you’re using
- Switch to the Command section
- Under "When command exits", select the option: Hold the terminal open
- Click Close to save changes
From now on, any command or script you run in Terminator will keep the window open after execution.
Option 3: Add a Line to Your Script
If you only want this behavior for this specific script, add one of these lines to the end of /home/test/test.sh:
- To drop directly into an interactive shell:
exec bash - To prompt the user before closing (useful if you want to review output first):
read -p "Script finished. Press Enter to exit..."
Each of these methods works reliably—pick the one that fits your use case best!
内容的提问来源于stack exchange,提问作者Santhosh

