Input from within shell script

前端 未结 4 1050
[愿得一人]
[愿得一人] 2020-12-01 18:44

I have a script that calls an application that requires user input, e.g. run app that requires user to type in \'Y\' or \'N\'.
How can I get the shell script not to ask

4条回答
  •  庸人自扰
    2020-12-01 19:44

    I prefer this way: If You want multiple inputs... you put in multiple echo statements as so:

     { echo Y; Y; } | sh install.sh >> install.out
    

    In the example above... I am feeding two inputs into the install.sh script. Then... at the end, I am piping the script output to a log file to be archived and viewed for later.

提交回复
热议问题