LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Bash Scripting handling user input sections automatically (http://www.linuxquestions.org/questions/programming-9/bash-scripting-handling-user-input-sections-automatically-814691/)

Gavin Harper 06-17-2010 06:01 AM

Bash Scripting handling user input sections automatically
 
I have a system setup script for my Slackware installations that pulls all packages and source files from another machine and sets everything up to be identical between machines. The script works as expected but I would love to make it entirely unattended.

How do I make the bash script deal with automatically selecting "Yes" for, for example "Install x(Yes/No): " when prompted by a make file?

Thank you

grail 06-17-2010 06:30 AM

Set variable equal to answer you want and then time the response to the question. If response received replace the current value, either way
your test will then read value and perform necessary action.

crts 06-17-2010 07:20 AM

Quote:

Originally Posted by Gavin Harper (Post 4006389)
I have a system setup script for my Slackware installations that pulls all packages and source files from another machine and sets everything up to be identical between machines. The script works as expected but I would love to make it entirely unattended.

How do I make the bash script deal with automatically selecting "Yes" for, for example "Install x(Yes/No): " when prompted by a make file?

Thank you

Hi,

Alernatively you can take a look at the yes command
Code:

man yes
If your script requires more complex answers you might want to take a look at 'expect'.

Gavin Harper 06-18-2010 10:35 PM

Thank you very much!


All times are GMT -5. The time now is 04:15 AM.