That's what the
yes command is for. It outputs
ys one per line indefinitely so it can be piped to commands that ask yes/no questions.
yes | /opt/MNG/MNGVIEWHP/fe/uninstall
y to all questions. To answer
n to all questions, replace
yes n. For a predefined mix of
n, you can replace
printf '%s\n' y n n y y n...
Or run it as:
/opt/MNG/MNGVIEWHP/fe/uninstall << 'EOF'
If you do need the answer not to be available for reading before 10 seconds, you'd do:
(sleep 10; echo y; sleep 2; echo n;...) | /opt/MNG/MNGVIEWHP/fe/uninstall
But that would probably not be necessary, when we write
y to the pipe, it's going to be there for
uninstall to read it whenever it wants to read it, it's unlikely you'd need to wait for it to be ready to read it. The exception would be if
uninstall decides to flush the input before asking the question.
All those assume the
uninstall command just reads each answer as one line of input from its standard input.
For more complex cases, where the command reads the answers directly from the tty device or where you need to feed answers conditionally (for instance based on what the command outputs), that's where you'd use things like
Note that many interactive programs can enter some non-interactive mode when passed some option. You may want to check their manual first, before spending too much effort working around the problem.