当我从 shell 脚本启动 Chrome 时,我想使用一些 URL 和启用标志来启动 Chrome。我已尝试以下操作,但只能实现启用标志或启动 URL。不是两个都在一起。
open -n /Applications/Google\ Chrome.app --args --enable-speech-input
或
open -n /Applications/Google\ Chrome.app www.google.com
上述两个命令都运行正确,但是当我尝试同时执行这两个命令时 像下面这样:
open -n /Applications/Google\ Chrome.app --args --enable-speech-input "www.google.com"
失败了。我尝试使用引号,但这不起作用。
最佳答案
不要使用 open
,而是直接从脚本运行 Chrome 可执行文件:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-speech-input www.google.com
如果打开 Chrome 后要运行更多命令,您可以通过在命令后添加 &
字符在后台打开 Chrome(请注意命令现在位于括号中):
(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-speech-input www.google.com) &
关于macos - 如何在 mac osx 上使用 shell 脚本中的标志和 URL 启动 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27359804/