Bash shell extension

I came across this cool tip whilst browsing the blog of a fellow storage geek’s who’d posted on the Linux RAID list.

Basically you can insert a variety of characters inside braces to expand them. I guess like a smart shell expansion using the tab. The most obvious usage is a major timesaver for creating a backup of a file (which of course we all should do everytime we edit a config file!).

cp foobar.conf{,.bak}

will work as:

cp foobar.conf foobar.conf.bak

Many more examples are given here.

Technorati Tags:

August 10, 2009. Computergeekery. Tags: . No Comments.

Bad Behavior has blocked 477 access attempts in the last 7 days.