Detect if homebrew package is installed

前端 未结 4 1054
梦如初夏
梦如初夏 2021-01-30 04:42

I\'m about to write a shell script to detect if several homebrew packages are installed in the system. Is there a way to use a brew command to achieve that?

I tried usin

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 05:34

    # install if we haven't installed any version
    brew ls --versions $lib || brew install $lib
    # install if we haven't installed latest version
    brew outdated $lib || brew install $lib
    

提交回复
热议问题