The question is related to Linux Debian, bash and python3.
Run python3 file from bash, send parameter from bash to py and output the result by echo on bash.
The follow are a sample which works for me. This one start a python3 script by bash and get the outpup of python3 script on terminal.
bash_script.sh
#!/bin/bash
python3 python_script.py
python_script.py #!/usr/bin/env python3
import random # import the random module
# determining the values of the parameters
mu = 100
sigma = 25
print(random.normalvariate(mu, sigma))
Whats my question: How to change the code, for send the parameter for "mu" and "sigma" from bash to python and output the python result on bash by "echo $python_script_output" ?
Follow the not working draft for a solution:
bash_script.sh
#!/bin/bash
mu = 100
sigma = 25
python3 python_script.py
echo $python_script_output
python_script.py
#!/usr/bin/env python3
import random
print(random.normalvariate(mu, sigma))