Tuesday, September 16, 2008

Bash : concatenate strings in bash

The problem -

You have $yr=2008
You want to obtain something like 2008_data.csv etc

$yr_data.csv does not work

The solution - Use curly braces to separate variables from strings
like this

${yr}_data.csv

2 comments:

Ketan said...

Thanks for your input. I'll certainly think over it.

Anonymous said...

Thank you for another excellent post. Keep rocking.