I am building a tool that in part acts as a preprocessor to yaml that should have shell command interpolation for getting outside information when parsing said yaml
The way in which I've built this is to find shell commands that are wrapped in a $eval(...)
and use subprocess.check_output
to get the return of such command.
I'm unable to figure out how to use $variables in check_outout, for example where export foo=bar
, subprocess.check_output(["echo", "$foo"])
should return b'bar'
. Instead, the literal b'$foo'
is returned.
Is there a way to tell check_output
to correctly parse these $variables?