Rakesh
Rakesh

Reputation: 11

How to key press "Arrow down/ Enter" key in shell script

I want to automate .sh installation. So, I have to key press 'Arrow down' key for selection and press 'Enter'.

./install.sh
expect "Welcome"
send "{down}"
expect "install"
send "Enter"

Upvotes: 1

Views: 3584

Answers (1)

Siddharth Dushantha
Siddharth Dushantha

Reputation: 1491

If you are using Linux, you can use xdotool to simulate keystrokes:

# To press the down arrow key
$ xdotool key Down

# To press the Enter key
$ xdotool key Return

Upvotes: 3

Related Questions