I am trying to find a way to run a python script with temporary env variables underground. I am using the following script to illustrate my approach, but it does not work.
example.py
import os
import sys
name = os.environ.get('CONF_NAME') + '.yaml'
print('Execution of the file {} '.format(name))
example.sh
OUTPATH="/home/user1/samples"
ERRPATH="/home/user1/samples"
PREFIX="CONF_NAME="$1""
EXECUTION_COMMAND="python"
FILE_TO_EXECUTE="example.py"
echo saving stderr to ${ERRPATH}
echo saving stdout to ${OUTPATH}
${PREFIX} nohup ${EXECUTION_COMMAND} ${FILE_TO_EXECUTE} > ${OUTPATH}/example_output.out 2> ${ERRPATH}/example_error.out &
But I get error of the form
example.sh: 10: CONF_NAME="conf_file_abc": not found
when I run the command
sh example_two.sh conf_file_abc
I would really appreciate your help to find a solution