Brace expansion in bash. . . new toy.
May 13th, 2007
I learned a new trick today, brace expansion in bash. Here’s some examples.
There are some definite uses like this,
$ wget http://www.anoyingpages.com/page_{1..12}
and this,
$ rm {old,lame}.{c,h}
If you get a moment on some asshole’s console, this
$ mkdir {a..z}{a..z}{a..z}
This is kind of neat.
$ echo {go,pa}{th,ne}
This is my favorite so far.
$ factor {1..1024}
on May 14th, 2007 at 12:56 PM
One thing I use brace expansion for all the time is to save myself from the potentionally dangerous “rm file.txt*” by doing “rm file.txt{,.bak}” instead. That, zsh’s glob qualifiers and extended globbing are 3 of the bigger reasons why nothing can replace a real shell anytime soon (for me, that is).