Last active
November 20, 2019 23:10
-
-
Save fvdm/1715d580a22503ce115c to your computer and use it in GitHub Desktop.
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/sh | |
if [ "$1" == "-h" ]; then | |
echo "Colorful Homebrew update script" | |
echo | |
echo "USAGE: update [-y]" | |
echo | |
echo " -y skip questions" | |
echo " -h display this help" | |
echo | |
exit 0 | |
fi | |
echo "\033[93mFetching packages list:\033[0m" | |
brew update | |
brewsy=`brew outdated | wc -l | awk {'print $1'}` | |
if [ $brewsy != 0 ]; then | |
echo "\033[93mOutdated packages:\033[0m" $brewsy | |
echo | |
brew outdated | |
echo | |
if [ "$1" != "-y" ]; then | |
ask=$(echo "\033[93mUpdate these packages?\033[92m [yn] \033[0m") | |
read -p "$ask" yn | |
fi | |
if [ "$yn" = "y" ]; then | |
brew upgrade --all && brew cleanup | |
else | |
echo "\033[93mOK, not doing anything\033[0m\n" | |
fi | |
else | |
echo "\033[93mNothing to do\033[0m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment