Skip to content

Instantly share code, notes, and snippets.

@lessmost
Last active September 6, 2018 01:12
Show Gist options
  • Save lessmost/a0c0439395ce4538d62d3b4c9e8211a2 to your computer and use it in GitHub Desktop.
Save lessmost/a0c0439395ce4538d62d3b4c9e8211a2 to your computer and use it in GitHub Desktop.
shell script to check outdated caskroom
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cleanup;)
#(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
casks=( $(brew cask list) )
for cask in ${casks[@]}
do
version=$(brew cask info $cask | sed -n "s/$cask:\ \(.*\)/\1/p" | sed "s/ (auto_updates)//")
installed=$(find "/usr/local/Caskroom/$cask" -type d -maxdepth 1 -maxdepth 1 -name "$version")
if [[ -z $installed ]]; then
echo "${red}${cask}${reset} requires ${red}update${reset}."
#(set -x; brew cask uninstall $cask --force;)
#(set -x; brew cask install $cask --force;)
else
echo "${red}${cask}${reset} is ${green}up-to-date${reset}."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment