David Thorisson
David Thorisson

Reputation: 1033

How to fake keyboard input to bash, on requrest?

I'm running serialized bash commands inside bash script to download (legally!) a few videos through sub-script using stream. The subscript starts with asking what quality to download (press keyb 1-4) and then goes on downloading for a few minutes.

How can I fake pressing 2 after question so that I can leave computer running without any further input until finished?

Upvotes: 0

Views: 423

Answers (1)

Arnaud Le Blanc
Arnaud Le Blanc

Reputation: 99921

This will send 2 to the script like you typed 2 on the keyboard

./the-script.sh <<EOF
2
EOF

Upvotes: 2

Related Questions