Short Stuff: bash brace expansion
Tags: bash
Published: 2020-01-23 20:16:27

Sometimes, you forget the little things.  I was reviewing AWS tools in [Homebrew for Linux](https://docs.brew.sh/Homebrew-on-Linux) and grew curious about some of the packages:

```
$ brew search aws
==> Formulae
aws-apigateway-importer       aws-elasticbeanstalk          aws-iam-authenticator         aws-okta                      aws-vault                     awscurl                       gimme-aws-creds
aws-cdk                       aws-es-proxy                  aws-keychain                  aws-sdk-cpp                   aws/tap/aws-sam-cli ✔         awslogs                       kube-aws
aws-cfn-tools                 aws-google-auth               aws-mon                       aws-shell                     awscli                        awsume                        yaws

```

So, I thought I'd pull up the info on several.  As I started to type things out, I realized how easy brace expansion could make this:

```
$ brew info aws{-keychain,-mon,curl,logs}
```

In Bash, this effectively becomes:

```
$ brew info aws-keychain
$ brew info aws-mon
$ brew info awscurl
$ brew info awslogs
```

giving the following output

```
$ brew info aws{-keychain,-mon,curl,logs}
aws-keychain: stable 3.0.0
Uses macOS keychain for storage of AWS credentials
https://github.com/pda/aws-keychain
Not installed
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/aws-keychain.rb
==> Analytics
install: 1 (30 days), 5 (90 days), 9 (365 days)
install-on-request: 1 (30 days), 5 (90 days), 9 (365 days)
build-error: 0 (30 days)

cloud-watch: stable 1.0.20.0
Amazon CloudWatch command-line Tool
https://aws.amazon.com/developertools/2534
Not installed
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/cloud-watch.rb
==> Requirements
Required: java ✔
==> Caveats
Before you can use these tools you must export some variables to your $SHELL.
  export AWS_ACCESS_KEY="<Your AWS Access ID>"
  export AWS_SECRET_KEY="<Your AWS Secret Key>"
  export AWS_CREDENTIAL_FILE="<Path to the credentials file>"
==> Analytics
install: 1 (30 days), 1 (90 days), 2 (365 days)
install-on-request: 1 (30 days), 1 (90 days), 2 (365 days)
build-error: 0 (30 days)

awscurl: stable 0.20 (bottled), HEAD
Curl like simplicity to access AWS resources
https://github.com/okigan/awscurl
Not installed
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/awscurl.rb
==> Dependencies
Build: pkg-config ✘
Required: python@3.8 ✘, libffi ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 2 (30 days), 2 (90 days), 2 (365 days)
install-on-request: 2 (30 days), 2 (90 days), 2 (365 days)
build-error: 0 (30 days)

awslogs: stable 0.11.0 (bottled), HEAD
Simple command-line tool to read AWS CloudWatch logs
https://github.com/jorgebastida/awslogs
Not installed
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/awslogs.rb
==> Dependencies
Required: python@3.8 ✘, openssl@1.1 ✔, zlib ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 909 (30 days), 2,729 (90 days), 11,596 (365 days)
install-on-request: 909 (30 days), 2,729 (90 days), 11,594 (365 days)
build-error: 0 (30 days)

```