2

I run a bash script. After some minutes execution it prompts me enter 'Y' or 'N' to continue. Some minutes later it can prompt me again some times.

Is it possible to answer its questions automatically in common if I know the count and sequence of right answers (e.g. Y, N, N, N)

2 Answers 2

3

Try a here document:

bashscript.shl [options] <<-END Y Y Y N END 

Put any kind of answer you want, passwords, etc. Will NOT work for ssh or sftp.

Sign up to request clarification or add additional context in comments.

Comments

1

The Expect tool used in cases like this. It is useful for automating interaction with CLI applications (Expect on Wikipedia).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.