4

bash: substitute parameter in a quoted string, stored in another variable

view full story
linux-howto

http://www.linuxquestions.org – Tired searching for this but I have no idea what this is called so bear with me please.. (variable substitution?) (parameter expansion?) Code: run_repeatedly() {     NUM=0     while [ <irrelevant stuff here> ]     do         NUM=$((NUM+1))         echo "$1"         eval "$1"     done } run_repeatedly "programX -o \"./messy/path/output-\$NUM.txt\"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1. Help? :scratch: (HowTos)