我如何能识别从bash脚本目前的终端仿真器? [英] How can I identify the current terminal emulator from a bash script?

查看:169
本文介绍了我如何能识别从bash脚本目前的终端仿真器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,将在OS X终端应用程序打开一个新的标签,我想增加对iTerm2支持。不幸的是,该方法以打开两个终端仿真器片是不同的。

I've got a script that will open a new tab in the OS X Terminal application and I'm trying to add support for iTerm2. Unfortunately, the methods to open tabs in the two terminal emulators are different.

怎么能分辨出哪两个正在使用,或者是开放,有条件地执行正确的脚本?

How could I tell which of the two is being used, or is open, to conditionally run the correct script?

推荐答案

我不知道该如何告诉的iTerm和iTerm2分开,但检查 $ TERM_PROGRAM ENVAR。对我(的Mac OS X 10.7),它返回 Apple_Terminal Terminal.app <​​/ code>和 iTerm.app <​​/ code>为iTerm2。

I'm not sure how to tell iTerm and iTerm2 apart, but check the $TERM_PROGRAM envar. For me (Mac OS X 10.7), it returns Apple_Terminal for Terminal.app, and iTerm.app for iTerm2.

这篇关于我如何能识别从bash脚本目前的终端仿真器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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