Last active
January 10, 2020 22:34
-
-
Save Leask/f6c139364c3511b4c203f784a674b66c to your computer and use it in GitHub Desktop.
Updating brew packages.
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
# Flora Up by LeaskH.com | |
up() { | |
echo 'Updating brew packages...' | |
brew update | |
brew upgrade --all | |
brew cleanup | |
echo ':) Done' | |
} | |
timestamp() { | |
date +%s | |
} | |
up_set() { | |
echo `timestamp` > /tmp/flora_up_at | |
} | |
up_get() { | |
upAt="`cat /tmp/flora_up_at 2> /dev/null`" | |
if [ "$upAt" = '' ]; then | |
echo 0; | |
else | |
echo $upAt; | |
fi | |
} | |
up_auto() { | |
((timdDiff=`timestamp`-`up_get`)) | |
((maxDiff=60*60*24)) | |
if [ $timdDiff -gt $maxDiff ]; then | |
up_set | |
up | |
fi | |
} | |
up_auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment