从 shell 脚本(Unix)中关闭终端窗口? [英] Close Terminal window from within shell script (Unix)?

查看:24
本文介绍了从 shell 脚本(Unix)中关闭终端窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从 shell 脚本中关闭终端窗口?我有一个 .command 文件,一旦完成,它就应该不碍事了.

Is there a way to close a Terminal window from within a shell script? I have a .command file that should just get out of the way once it's done.

推荐答案

使用 exit 0 将干净地终止脚本.

Using exit 0 will cleanly terminate the script.

终端窗口是否保持打开状态是用户可配置的.默认设置是始终保持打开状态.要改变这一点:

Whether Terminal window stays open is user-configurable. The default is to always stay open. To change this:

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,脚本将关闭窗口,如果没有出错则为默认值.

When "Close if shell exited cleanly" is used, the script will close the window if the exit result is 0, which is the default if nothing went wrong.

这篇关于从 shell 脚本(Unix)中关闭终端窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆