Created
September 9, 2016 14:03
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 | |
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