My program runs(exec..) an external program.
While running, the external program asks user [Yes/No] to proceed next step.
Instead of typing [yes] in command line, how can I pass [Yes] to the external program from my program.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unless the external program supports a respective flag (see @Jonathan Leffler’s answer), your you have control over that program’s source and can add it, you have to simulate the “yes” input.
Options:
Try launching the external program by piping the output of the
yeshelper application to it’s stdin:yes | external_program.yesis a simple tool, should you not have it, that just writes “y” to it’s stdout continually.Manually write “yes” to to stdin of the external program.
Both options require your to use pipes in one way or the other. See this for more information on how to do that.