-1

i am new to scripting, i am running an bin file through a bash command, and once the bin starts to run its expects an enter key to continue. Below is the script

#!/bin/bash
pwd; cd /root/program;
pwd;
echo start install
echo !@#$%^
sleep 10;
sh program.bin;

once the bin starts to execute it expects an enter. Can any one please guide me.

user2470170
  • 2,320
  • 2
  • 13
  • 8
  • 1
    Depending on how the binary reads the input you can pipe `echo` with your binary or you will have to use more heavy weapon like `expect`. First, try this: `echo Yes | ./program.bin` – frist Jul 19 '16 at 06:24
  • What does the script `program.bin` look like? – Kusalananda Jul 19 '16 at 06:25
  • For automating interactive console applications, keep in mind the [`expect`](https://en.wikipedia.org/wiki/Expect). – Dummy00001 Jul 19 '16 at 09:20
  • Please comment on the provided solutions @user2470170, so that it can be improved further! – Inian Jul 20 '16 at 13:13

1 Answers1

0

For triggering a keypress using bash, take a look at xdotool. You can get it using apt-get install xdotool and its documentation is found here (http://www.semicomplete.com/projects/xdotool/xdotool.xhtml). The text to trigger an enter keystroke is KP_ENTER.

VortixDev
  • 965
  • 1
  • 10
  • 23