---
title: Bracket Expansion
teaser:
tags: unix
author: Gabe Berke-Williams
published_on: 2012-02-21
---

Let's say you want to update [capybara](https://github.com/jnicklas/capybara)
and [capybara-webkit](https://github.com/thoughtbot/capybara-webkit). You'd
normally type this:

    gem update capybara capybara-webkit

But you're busy, you don't have _time_ to type "capybara" twice. Let's see what
tab completion has for us:

    gem update capybara{,-webkit}

The bracket expression expands to the same thing as abovebecause the brackets
expand to `"capybara" + ""` and `"capybara" + "-webkit"`. If you're in ZSH, you
can press the TAB key (`gem update capybara{,-webkit}[TAB]`) and it will expand
the expression for you inline. Bash users, this will still work for you, even
without the neat TAB trick.
