Have bash script answer interactive prompts [duplicate] Have bash script answer interactive prompts [duplicate] bash bash

Have bash script answer interactive prompts [duplicate]


A simple

echo "Y Y N N Y N Y Y N" | ./your_script

This allow you to pass any sequence of "Y" or "N" to your script.


This is not "auto-completion", this is automation. One common tool for these things is called Expect.

You might also get away with just piping input from yes.


I found the best way to send input is to use cat and a text file to pass along whatever input you need.

cat "input.txt" | ./Script.sh