-1

This question already has an answer here:

If I run

export TEST=script.py
echo $TEST

It outputs script.py

script.py code:

return 5

can TEST be set to 5? Obviously script will do something in future not just return a number

marked as duplicate by terdon Apr 23 '15 at 16:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Yes:

$ export TEST=`script.py`
$ echo $TEST
5

You need to tell the shell to set test to the result of running script.py, which is what the backticks do for you. There are alternate shell constructs that will do the same thing, like $(script.py), but I almost always use backticks.

Not the answer you're looking for? Browse other questions tagged or ask your own question.