automatically respond sh file "read" command with paramiko

I have the following script do execute

>> cat myscript
echo "init"
read input_var
echo "test" $input_var
read input_var1
echo "test1" $input_var1
read input_var2
echo "test2" $input_var2

>> ./myscript
a                      <-- read
test a
b                      <-- read
test1 b
c                      <-- read
test2 c

Is there a way to execute this with paramiko library on python? I managed to execute simple files without those reads, but when I execute that one, it keeps waiting for the response.

I can not change that to something like ./myscript a b c

Read more here:

Content Attribution

This content was originally published by ThRnk at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: