【发布时间】:2020-11-21 20:56:16
【问题描述】:
我正在尝试通过 mac 上的 bash 脚本获取 chrome 的版本。我可以直接从终端运行以下命令:
macbook-pro:jenkins_server$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
Google Chrome 87.0.4280.67
但是当我尝试将这样的内容放在 bash 脚本中时:
EXEC="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
"$EXEC" --version
我得到以下结果:
macbook-pro:jenkins_server$ ./test_script.sh
./test_script.sh: line 2: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome: No such file or directory
【问题讨论】: