Verbose Logging

software development with some really amazing hair

T + S G I F R

Bash Brace Expansion For Less Typing

· · Posted in Software
Tagged with

Named a file wrong? Need to move it to another directory? No big deal.

What if you named a view file foo.haml instead of the proper foo.html.haml?

mv app/views/widgets/foo.{haml,html.haml}

Does exactly what you think it does. It expands to:

mv app/views/widgets/foo.haml app/views/widgets/foo.html.haml

Since it's just bash, it also works with git:

git mv app/views/widgets/foo.{haml,html.haml}

Works within the path too:

git mv app/views/{widget,whatsit}/foo.html.haml

Sharing is Caring