You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux Terminator终端:如何运行Bash脚本后不自动关闭

Fix: Keep Terminator Open After Bash Script Finishes

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:40:48