-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

John
  • 17,011

1 Answers1

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.

John
  • 17,011