-1

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

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.

| improve this answer | |

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