0

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?

0

1 Answer 1

1

$(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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.