This should be pretty straightfoward in bash, and I don't know why I am struggling with it. I am a bash newbie, so please be gentle.
pseudo code:
read a configuration file, extract the first line beginning with a key/value pair
in the format exec=/path/to/myprog -opt1 -opt2 $var1 $var2 ...
check that the /path/to/myprog is executable
if executable then
replace $var1, ... with the contents of the same bash variables in the script
check that all variables were replaced with existing bash variables
if aok
execute the command and be happy
else
complain echoing the partially-substituted command string
fi
else
complain echoing the un-substituted command string
fi
Nothing I try seems to work properly. I have killed enough time trying various things. Suggestions, anyone?