Imagine that you have to create many lines in file all with the same text except for one variable:
foo text $variable bar text
foo text $variable bar text
foo text $variable bar text
...
I was wondering if this could be made using a bash script passing it the variable as an argument:
./my_script '1'
./my_script '2'
./my_script '3'
Which would generate this:
foo text 1 bar text
foo text 2 bar text
foo text 3 bar text
Any suggestions or examples on how to do this?
cat >>output.file "foo text $1 bar text"
. Or can you better describe what you may really want(?) – Art Swri Mar 2 '12 at 18:12for i in {1..3}; do echo foo text $i bar text; done
– Gandaro Mar 2 '12 at 18:31