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

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

问题描述

有没有办法从shell脚本中关闭终端窗口?我有一个.command文件,一旦完成后应该得到解决。

解决方案

使用 exit 0 将干净地终止脚本,但是是否终止 >窗口保持打开状态是用户可在终端的首选项中配置。默认是始终保持打开,但我更喜欢设置关闭,如果shell退出干净。可以在 - > - > 当shell存在时中更改。使用该设置,如果退出结果为0(这是默认值,如果没有出错),脚本将自动关闭窗口。


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.

解决方案

(converted to an answer from my comment as suggested)

Using exit 0 will cleanly terminate the script, but whether Terminal window stays open is user-configurable in Terminal's preferences. The default is to alway stay open, but I prefer the setting "Close if shell exited cleanly". It can be changed in Settings -> Shell -> When the shell exists. With that setting the script will close the window automatically if the exit result is 0 (which is the default if nothing went wrong).

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

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