0

Im running this command from ruby script:

system "trad install"

This will prompt me three times for choosing y/n.

Is there a way to automatically choose y,y,n?

4 Answers 4

3
echo -e "Y\nN\nN\n" | trad install
Sign up to request clarification or add additional context in comments.

1 Comment

Great answer and simple answer! :)
1

You can probably automate a run with Session and Ruby's built-in pty/expect (which seems to have no online documentation). (Dave Thomas has a few brief examples of expect and pty in recent editions of Programming Ruby, if you have a copy of that.)

However, I agree with Dmitry: it's almost certainly easier to adjust trad if possible.

1 Comment

I think expect is what you want to try.
0

well, you might want to use

pipe = IO.popen("trad install")
pipe.write "yyn"

Not sure if that works, however.

Comments

0

I don't think you can do that. If trad is your application, the best way is to add options to it.

Comments

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.