问题描述
限时送ChatGPT账号..我有一个脚本可以在 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
环境.对我来说(Mac OS X 10.7),它为 Terminal.app
返回 Apple_Terminal
,为 iTerm2 返回 iTerm.app
.
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屋!
更多推荐
[db:关键词]
发布评论