In my current project I'm trying to execute a .sh file with a python program, giving input and reading output The problem is that I have no idea on how to give the input (I managed to read the output in this way, searching on the internet. I'll listen to any suggestion). Here I write an example code (for the original one is longer and more complicated, but this is the essence and the problem is the same)
import subprocess
greet = subprocess.Popen(["bash", "helloWorld.sh"],
stdout=subprocess.PIPE,
encoding="utf-8")
print(greet.stdout.read())
and this is the simple helloWorld.sh
read name
echo "Hello $name"
My OS is Debian (xfce) and I'm wirting in Python 3.7 Ask for any other detail