gpt4 book ai didi

macos - 从 shell 脚本 (Unix) 中关闭终端窗口?

转载 作者:行者123 更新时间:2023-12-03 05:51:19 27 4
gpt4 key购买 nike

有没有办法从 shell 脚本中关闭终端窗口?我有一个 .command 文件,一旦完成就应该消失。

最佳答案

使用exit 0将彻底终止脚本。

用户可以配置终端窗口是否保持打开状态。默认值是始终保持打开状态。要更改此设置:

Terminal.app > Preferences > Profiles > Shell
- "When the shell exists:"
> Close if the shell exited cleanly
- "Ask before closing:"
(•) Never
-- OR --
(•) Only if there are....

当使用“Close if shell exited cleanly”时,如果退出结果为0,脚本将关闭窗口,如果没有任何问题,这是默认值。

关于macos - 从 shell 脚本 (Unix) 中关闭终端窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8798641/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com