bash - Python os.system() input text to script -
I have a script that I need to automate, so it's a .sh
script Which I want to run inside a dragon script: something like this:
import os ossystem ('. / Script.sh -p 1234')
scriptscript.sh
needs user to input 3 fields, 1) pseudo password, 2) string and 3) a string.Enter the password for the user: Xxxx # Enter the name of the YouTube username that I typed: xxxx # Enter the atypic password I typed: xxx # I have typed by
How can I type / insert the python script / type those 3 as required values for
script.sh
.
You can use the subprocess Popen
to start the script and To pass this input, communication
method something like this:
import subprocessor p = subprosec POPEAN (['. / Script.sh', '-p', '1234'], stdin = subprocess.PIPE, stdout = subprocess .ppei) stdout, stderr = p.com muitet (input = 'password \ nauth username' \ 'Password password \ n)
Comments
Post a Comment