I've got this example:
[nir]$ cat a.cfg
--arg1 $(./get.sh variable)
[nir]$ cat get.sh
echo "${1}-info"
[nir]$ cat a.sh
arg=$(cat a.cfg)
echo "$arg"
[nir]$ ./a.sh
--arg1 $(./get.sh variable)
I want the a.sh
to return --arg variable-info
. the end result is to switch the echo
with a real command that takes a.cfg
, parse it, and send it as the arguments.
a.sh
anda.cfg
don't take any arguments. That's not what you're looking for, but it's hard to tell which parts of the whole thing here can't be modified (e.g. because they're actually third-party commands). I would probably approach that by changinga.cfg
to a script that outputs the required stuff, so you'd usearg=$(otherscript.sh)
instead ofarg=$(cat otherfile)
. Running code in there is going to be the end result anyway.