-1

I need to write a bash script that runs some console application with arguments, lets say app.exe -arg. The problem is, that program while it's working, asks user to press some key e.g. press o for OK or c for Cancel. I need to scan output at all times for such expressions and press certain keys when needed. Ideally I would have a set of rules that whould apply to the whole output for the whole time, and when expression 1 is found, do this, when expression 2 is found in output, do that (like press some key) and allow output to be examined further the same fassion. Until some "ending expression" is found, then close script. Im kinda newbie in bash scripting. Any help?

PanBocian
  • 43
  • 6

1 Answers1

0

expect is the answer to your question. It allows you to automate such procedures:

  • wait for a certain phrase
  • provide input
  • ...
Chris Maes
  • 35,025
  • 12
  • 111
  • 136