Skip to content
Advertisement

How to make python script type when prompted on shell

Something similar to this: How to make python script press ‘enter’ when prompted on Shell

Like that question, if I have test_enter.py:

JavaScript

and this file:

JavaScript

But instead of just a new line, I want it to type something then press “enter”. Is that possible?

Advertisement

Answer

Script to call:

JavaScript

Caller script:

JavaScript

Run command

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement