LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2011, 08:59 AM   #1
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Rep: Reputation: 15
Bash shell scripting doubt


Hello All,

I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further.

The script is categorized in 5 parts and in the last part while building software it asks for few questions like:-

1. Build mode choice
2. normal build
3. Copy Images
4. Arch

User manually has to input ans for these questions:-
1
yes
n
64


The ans's are fixed and this won't change. How shall i hard-code them or do something in the script so as when script flow reaches to this point it automatically take's these value.

So far the cron job is not getting completed as it's waiting for user to key in these values manually....



I had faced similar issue while building kernel modules but there it was easier as i had to take default values always:-

yes '' | make kernel
//this worked.


But in the current scenario i need to input values......


Any inputs??
 
Old 07-27-2011, 09:04 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well just find that bit of the code and replace what I'd expect to be a "read" command with a direct variable assignment. Without seeing the code, not sure what we're supposed to say...
 
Old 07-27-2011, 11:21 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,428

Rep: Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829Reputation: 2829
If we are to assume that this script may also be run manually and hence you do not wish to change the fact that people may enter alternate options, I would suggest
setting the defaults for each variable and then using reads -t option to set a timeout so if a new value is not entered then the default will be used.
 
  


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
Shell Scripting doubt varunisac Programming 5 12-02-2010 12:54 PM
bash shell scripting help! computergeek7 Programming 2 04-27-2010 11:35 AM
Bash scripting doubt bala1486 Linux - Newbie 4 04-09-2010 06:49 AM
Bash shell scripting Sco Linux - Newbie 1 11-09-2004 12:58 PM
BASH Shell scripting help ewarmour Linux - General 8 05-25-2002 08:10 AM


All times are GMT -5. The time now is 03:41 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration