Skip to content

Instantly share code, notes, and snippets.

@inlife
Last active February 9, 2020 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inlife/2883d8aa56fbbcc47493 to your computer and use it in GitHub Desktop.
Save inlife/2883d8aa56fbbcc47493 to your computer and use it in GitHub Desktop.
Search and install desired cask in one move.
# 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
Copy link

ghost commented Feb 8, 2016

I think you mean select RESULT in ${OPTIONS[@]};, instead of select RESULT in $OPTIONS;.

@inlife
Copy link
Author

inlife commented Feb 8, 2016

@antuankhanna, thank you! Fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment