I am trying to dynamically create some shell script and run it (but don't know how!).
I want to read in a string from a file (e.g. ' echo $myvar
') then run that string (and, yes, myvar IS an existing variable).
Can it be done? I have thought about writing it off to a .sh file and executing the file, but I can't get that to work either.
To put the problem into context, I want to read in a bunch of commands from a file and run them, and they may contain names of existing variables.
Incidentally, I'm using bash, but a general solution will be fine.