Redirect bash output to dynamic file name
bash, dynamic, filenames
Solution
Just concatenate $1 with the "team.csv".
#!/bin/bash
mdb-export 2011ROXBURY.mdb TEAM > "${1}team.csv"
In the case that they do not pass an argument to the script, it will write to "team.csv"
Problem
I'm writing a bash script that will (hopefully) redirect to a file whose name is generated dynamically, based on the the first argument given to the script, prepended to the some string. The name of the script is ./buildcsvs. Here's what the code looks like now, without the dynamic file names ``` #!/bin/bash mdb-export 2011ROXBURY.mdb TEAM > team.csv ``` Here's how I'd like it to come out ``` ./buildcsvs roxbury ``` should output ``` roxburyteam.csv ``` with "$1" as the first arg to the script, where the file name is defined by something like something like ``` "%steam" % $1 ``` Do you have any ideas? Thank you