[英]How to find the executable file for “open” command in Mac?
我想通过mac终端打开我的许多程序,因为我经常使用它。 例如,我希望能够通过键入open chrome
从Mac OSx终端启动“chrome”。
当然,这只有在环境变量path
知道在哪里找到该程序的可执行文件时才有效。 我已经尝试使用以下方法搜索应用程序的可执行文件(例如chrome):
find . -iname "*chrome*"
但结果都没有效果(当然也有很多结果)。 所以,我想知道什么是最好的方法
1)找到要添加到PATH环境变量的可执行文件或2)通过其他方法启动应用程序
谢谢。
一般来说,就我所见,您几乎可以启动任何类似的应用程序:
# binary file:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
# open .app:
open /Applications/Google\ Chrome.app/
# binary + variable:
appName="Google Chrome"
"/Applications/$appName.app/Contents/MacOS/$appName"
# open + variable:
appName="Google Chrome"
open "/Applications/$appName.app/"
希望这可以帮助! :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.