我想通过mac终端打开许多程序,因为我经常使用它。例如,我希望能够通过输入从Mac OSx终端启动“ chrome” open 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/"
希望这可以帮助!:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句