我正在编写一段脚本以自动设置 Mac 上的开发环境,但是在有些人的 Mac 上遇到了问题,其中 cask(Homebrew 扩展)无法安装。有没有办法在 bash 中检查 cask 是否已经安装?
理想情况下,我希望像这样做:
理想情况下,我希望像这样做:
if caskIsInstalled then
# do stuff...
fi
我已经通过type
命令验证了brew是否安装,但是我无法找到一种方法来验证cask。
if ! type "brew" > /dev/null; then
echo "Failed to install Homebrew"
# do stuff...
fi
brew list
的输出?看看brew info cask
是否在这种情况下有用的信息? - Etan Reisnerbrew info cask
返回Error: No available formula for cask
。 我可以使用什么工具在 bash 中解析输出吗? - Mike Rylander