LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-17-2010, 06:01 AM   #1
Gavin Harper
Member
 
Registered: Feb 2010
Location: Finland
Distribution: Slackware
Posts: 169

Rep: Reputation: 24
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
 
Old 06-17-2010, 06:30 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,437

Rep: Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879
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.
 
Old 06-17-2010, 07:20 AM   #3
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Quote:
Originally Posted by Gavin Harper View Post
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'.
 
Old 06-18-2010, 10:35 PM   #4
Gavin Harper
Member
 
Registered: Feb 2010
Location: Finland
Distribution: Slackware
Posts: 169

Original Poster
Rep: Reputation: 24
Thank you very much!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash scripting... taking user input and adding it to a particular area of a file... dagummit Programming 7 01-13-2010 12:07 AM
Bash: Handling input from file and keyboard moo-cow Programming 4 01-24-2009 08:21 AM
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 06:40 PM
Bash Scripting: Pipe input to script vs. $1 jhwilliams Linux - Software 3 12-21-2007 10:54 PM
Bash scripting and user input Woodsman Slackware 13 11-02-2005 02:20 PM


All times are GMT -5. The time now is 07:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration