In one of my shell script I am using eval command like below to evaluate the environment path -
CONFIGFILE='config.txt'
###Read File Contents to Variables
while IFS=\| read TEMP_DIR_NAME EXT
do
eval DIR_NAME=$TEMP_DIR_NAME
echo $DIR_NAME
done < "$CONFIGFILE"
Output:
/path/to/certain/location/folder1
/path/to/certain/location/folder2/another
In config.txt -
$MY_PATH/folder1|.txt
$MY_PATH/folder2/another|.jpg
What is MY_PATH?
export | grep MY_PATH
declare -x MY_PATH="/path/to/certain/location"
So is there any way I can get the path from python code like I could get in shell with eval
MY_PATHin the python program, or in the environment before running the program?