Last active
January 29, 2018 10:35
-
-
Save mstrzele/5a4a31f3dfe79e7cae081e0fa66863ab to your computer and use it in GitHub Desktop.
Homebrew-Cask upgrade
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
#!/usr/bin/env bash | |
outdated() { | |
local token="${1}" | |
local info | |
local cask | |
local path | |
mapfile -t info < <(brew cask info "${token}") | |
read -r -a cask <<< "${info[0]}" | |
read -r -a path <<< "${info[2]}" | |
# shellcheck disable=SC2203 | |
[[ $path[0] != *"${cask[1]}"* ]] | |
} | |
casks="" | |
for cask in $(brew cask list); do | |
if [[ "${cask}" != 'google-chrome' ]] && [[ "${cask}" != 'skype' ]] && | |
outdated "${cask}"; then | |
casks="${casks} ${cask}" | |
fi | |
done | |
if [[ -n "${casks}" ]]; then | |
# shellcheck disable=SC2086 | |
exec brew cask upgrade ${casks} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment