Skip to content

Instantly share code, notes, and snippets.

@RyanPossible
Created September 9, 2016 14:03
Show Gist options
  • Save RyanPossible/4cef37ea0ba9a6d9facd337f2c818c69 to your computer and use it in GitHub Desktop.
Save RyanPossible/4cef37ea0ba9a6d9facd337f2c818c69 to your computer and use it in GitHub Desktop.
#!/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