Last active
February 9, 2020 10:11
-
-
Save inlife/2883d8aa56fbbcc47493 to your computer and use it in GitHub Desktop.
Search and install desired cask in one move.
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
# Search for cask, select & install | |
## 0.1 Inlife | |
function caskdo { | |
echo 'Searching...'; | |
OPTIONS=($(brew cask search $1 | grep -e '^[^=]')); | |
if [[ "$OPTIONS" == *"No Cask found"* ]]; then | |
echo "Not found anything like \"$1\"" | |
else | |
echo 'Select number of cask you want to install: ' | |
select RESULT in ${OPTIONS[@]}; | |
do | |
echo "Installing $RESULT"; | |
brew cask install $RESULT; | |
echo "Done."; | |
exit; | |
done | |
fi | |
} | |
# Example | |
caskdo google |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you mean
select RESULT in ${OPTIONS[@]};
, instead ofselect RESULT in $OPTIONS;
.