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
Alex Thomson
  • 143
  • 1
  • 3
  • 10
  • possible duplicate of [Simulating ENTER keypress in bash script](http://stackoverflow.com/questions/6264596/simulating-enter-keypress-in-bash-script) – Etan Reisner Mar 09 '15 at 19:50

1 Answers1

2

this should work:

echo | ./clientScript.py

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

Jason Hu
  • 6,239
  • 1
  • 20
  • 41