-
-
Save ysaito8015/d33c438ba572aa1e52d0208dabe76350 to your computer and use it in GitHub Desktop.
brew cask upgrade
This file contains 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
#!/bin/bash [0/0] | |
set -Ceu | |
for c in $(brew cask list); do | |
info=$(brew cask info $c) | |
installed_ver=$(echo "$info" |awk 'NR==1' |cut -d" " -f 2) | |
current_ver=$(echo "$info" |awk 'NR==3' | cut -d" " -f 1 | rev |cut -d"/" -f 1| rev) | |
if [ "$current_ver" == "latest" ]; then | |
echo "$c is installed '$installed_ver', current is '$current_ver'" | |
echo -n "upgrade?[y/n]>" | |
read INPUT | |
if [ $INPUT == "y" -o $INPUT == "Y" ]; then | |
brew cask reinstall $c | |
else | |
echo "skip upgrade" | |
fi | |
elif [ "$installed_ver" != "$current_ver" ]; then | |
echo "$c is installed '$installed_ver', current is '$current_ver'" | |
brew cask reinstall $c | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment