Skip to content

Instantly share code, notes, and snippets.

@hp9390
Created June 24, 2016 07:22
Show Gist options
  • Save hp9390/e1c1cda7bd64a82a7bb12539255e5956 to your computer and use it in GitHub Desktop.
Save hp9390/e1c1cda7bd64a82a7bb12539255e5956 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
casks=( $(brew cask list) )
for cask in ${casks[@]}
do
installed=( $(ls /opt/homebrew-cask/Caskroom/$cask))
if [ ${#installed[@]} -gt 1 ]; then
echo "${red}${cask}${reset} has installed multiple ${red}versions${reset}."
(set -x; brew cask uninstall $cask --force;)
(set -x; brew cask install $cask --force;)
else
echo "${red}${cask}${reset} is ${green}ok${reset}."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment