Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-27-2011, 08:59 AM   #1
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:-

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
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,563

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
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.


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:21 PM.

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