Last Updated: February 25, 2016
·
480
· iamjarvo

Brace Expansion

Never type your filepath twice again!

Have you ever been in the root of your rails app and wanted to copy your database_template.yml and name it database.yml? I have been doing:

cp config/database_template.yml config/database.yml

I disliked typing the path again! So new command:

cp config/{database_template,database}.yml

This will create a copy of the file and name it database

The command expands to:

echo config/{database_template,database}.yml
=>  cp config/database_template.yml config/database.yml