Shell script: Hello.sh
#!/bin/bash
echo "Enter your name: "
read name
echo "Hello $name"
I want to invoke Hello.sh from within python and fill variable "name" non-interactively. How can it be done?
Not sure how to read your question. EDIT: Comment was added by the OP: invoke Hello.sh from within python and "fill" name noninteractively Which changes things, so here is a different answer for the new question:
I have used the full path to the script, it is safer. | |||||||||
|
| |||||||||
|
Hello.sh
from withinpython
and "fill"name
noninteractively. If so, I believe that the answer John's looking for is to usesubprocess
andwrite
to thestdin
handle. – Brian Cain Mar 21 at 13:27