I need to run some Shell/Bash scripts inside Python (eg. using subprocess or system) and get the values of some variables inside those scripts. I know the name of the variables because they are the same in every one of then, but the values are different.
I cannot use regex to extract the variables content because sometimes those scripts come with processing, like if statements that will change the content of those variables based on the computer specs (eg. version of the linux kernel, architecture...).
But i will download those scripts, so i cannot simply add the variables to the env or echo the variables content from the script, i need to get the script variables from Python.
The really ideal is to avoid even save the script to the disk because it will ran several times and write/read from disk can be a problem. I'm using urllib to get the script from a web address.