Last active
December 17, 2017 19:08
-
-
Save danijeljw/9f5f400a9f30c7c99090c520cf5aa7e0 to your computer and use it in GitHub Desktop.
Upgrade casks installed via Homebrew Cask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
brew update | |
brew cask update | |
casks=( $(brew cask list) ) | |
for cask in ${casks[@]} | |
do | |
# in the first line there is version | |
current="$(brew cask info $cask | sed -n '1p' | sed -n 's/^.*: \(.*\)$/\1/p')" | |
installed=( $(ls /opt/homebrew-cask/Caskroom/$cask)) | |
if (! [[ " ${installed[@]} " == *" $current "* ]]); then | |
(set -x; brew cask install $cask --force;) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment