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.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Technorati Tags:

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

No Comments

Be the first to comment!

Leave a Reply

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