Reputation: 1130
I have a python file, conf.py
which is used to store configuration variables. conf.py
is given below:
import os
step_number=100
I have a bash script runner.sh
which tries to reach the variables from conf.py
:
#! /bin/bash
#get step_number from conf file
step_number_=$(python ./conf.py step_number)
However, if I try to print the step_number_
with echo $step_number_
, it returns empty value. Can you please help me to fix it?
Upvotes: 0
Views: 256
Reputation: 781096
$(command)
is replaced with the standard output of the command. So the Python script needs to print the variable so you can substitute it this way.
import os
step_number = 100
print(step_number)
Upvotes: 1