0

This is my first bash script. I want to run a script five times, the script is located in the same folder that this script will be located. My problem is that I cannot find how to simulate pressing enter. Since this script needs to load the data first it takes two seconds after running it, then it prompts you to press enter. I want to simulate doing this five times. How can I do the 3 second delay and press enter after? Any other problems with my script?

#!/bin/bash

for i in {1..5}
do
   ./clientScript.py
   #Press enter after a 3 second pause
done
1

1 Answer 1

2

this should work:

echo | ./clientScript.py

it simply outputs a \n to the stdin of your python script.

Sign up to request clarification or add additional context in comments.

2 Comments

This doesn't pause and doesn't have to -- the application will just spend a few seconds loading and will read the input when it finds the time.
To send 3 newlines: { echo; echo; echo; } | program or printf "\n\n\n" | program

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.