I'd like to get shell variable content to be used within a python script, specifically to get path out of it to be used later for a function call to a python script located at another directory, using sys.path.insert
Let's assume my shell variable is called SHELL_VAR1
, and I want to concatenate to it /scripts
folder name, so I get flow like that - using in this example os.environ.get
just to illustrate my need in case it was environment variable and not a shell variable - and the question is what should be used instead:
python -c 'import os; import sys;var1=os.environ.get('SHELL_VAR1'); sys.path.insert(1, 'var1' ''/scripts'');'