Best way to get the name of a Cask?

In a Bash script, for a given Cask token I want to get the name of the application. This seems to work:

brew cask cat microsoft-office | grep name | awk -F\' '{print $2}'

But this is a bit of a kludge and I’m curious if “brew cask info” can give me just the name of a Cask?

isn’t microsoft-office the name of the cask?

Yes, I suppose I mean that I want to reliably get the name of the application that the Cask installs. So this:
brew cask cat microsoft-office | grep name | awk -F’ ‘{print $2}’

Returns this:
Microsoft Office

And I’ve tried it with a number of random Casks and it seems to work. If there’s not a more natively Homebrew-ish way to get there then maybe I will grow my Ruby skills a little bit and extend “brew cask info” to output specific fields. :grinning:

I don’t think homebrew knows what it installs to. But instead of using brew cat there might be an option to use brew info --json

1 Like