'Tip of the Day for Every Linux or Unix User: Brace Expantion'

May 02, 2009 Category: Uncategorized

Searching the web I discovered some really nice feature of the unix shell, which I didn't know about.

Try this:

touch foobar.conf

Now try this:

cp foobar.conf{,.bak}

It is equivalent to:

cp foobar.conf foobar.conf.bak

This is also the easiest way to create sequences. Do not use 'seq' since you cannot rely on it being installed.

bash-3.2$ echo {1..10}

1 2 3 4 5 6 7 8 9 10

Please visit this location for additional examples.

Comments