Created
September 9, 2016 14:03
-
-
Save RyanPossible/4cef37ea0ba9a6d9facd337f2c818c69 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
toUpgrade=('git' 'node' 'wget' 'openssl') | |
array_contains () { | |
local array="$1[@]" | |
local seeking=$2 | |
local in=1 | |
for element in "${!array}"; do | |
if [[ $element == $seeking ]]; then | |
in=0 | |
break | |
fi | |
done | |
return $in | |
} | |
echo "Good Morning Mr. Schumacher!" | |
echo "Updating Brew:" | |
brew update | |
OUTDATED="$(brew outdated)" | |
IFS=' ' read -ra FORMULAES <<< "$OUTDATED" | |
for FORMULAE in "${FORMULAES[@]}"; do | |
array_contains toUpgrade "$FORMULAE" && echo "$(brew upgrade $FORMULAE)" | |
done | |
echo "Have a good day Mr. Schumacher!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment