0

I am creating a script but I am stuck because I need it to stimulate user input for another script that is call. I am able to answer the first question by going: echo "y" | othercommand.sh But I need to stimulate the answers for the other two questions, how would I go about this.

Thanks.

4
  • What do you mean by "stimulate"? Commented Feb 4, 2013 at 12:22
  • 1
    You talk about 3 questions, but I cannot understand a single one of them, can you please clarify? Commented Feb 4, 2013 at 12:25
  • so are you kind of trying to treat the script like a function that returns a value? I'm not sure I follow Commented Feb 4, 2013 at 12:27
  • 1
    here and here Commented Feb 4, 2013 at 12:27

1 Answer 1

0

Assuming you want to answer y, y, n to the three questions, you can use a here-doc as shown below:

othercommand.sh << END
y
y
n
END
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, I have a srcipt and from this script I am calling another another script. But this script requires user input from command line. How do i stimulate this user input from my initial script?
Hi @dogbone, that doesn't seem to work. It still just accepts the fist input and ignores the others?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.