Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 21st, 2005, 8:44 PM   #1
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Read configuration from a text file?

I'm working on an automated installer for Slackware Linux, much like Windows unattended setup, which simply reads configuration from unattend.inf. I'm trying to find a decent way to replicate the config file, and have no clue on how to use bash to read in from a file like so:
RootPartition=/dev/hda2
and assign the root partition to /dev/hda2. I'm almost thinking a script like so:
#!/bin/sh
ROOT=/dev/hda2
SWAP=/dev/hda3
KERNEL=bareacpi.i
etc.
export ROOT
export SWAP
export KERNEL
etc.
would be the best route, with the setup scripts then finding $ROOT, $SWAP, etc., but certainly there's a better method?
niteice is offline   Reply With Quote
Old Aug 22nd, 2005, 10:13 AM   #2
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
look up the Bash Advanced Guide. You can read in the text line by line, then parse the string splitting it by the '=' the left variable will become the name, the right variable will become the value. If the parser sees the 'export' keyword, it reads the line in differently, namely it splits the line by the ' ' and the left part gets discarded, while the right part gets added to an array of modules to export. Or something like that.
Good luck
Dizz
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old May 18th, 2006, 4:42 AM   #3
DaveQB
Newbie
 
DaveQB's Avatar
 
Join Date: Apr 2006
Location: Sydney
Posts: 14
Rep Power: 0 DaveQB is on a distinguished road
Send a message via ICQ to DaveQB Send a message via Skype™ to DaveQB
I normally just source the config file.

Something like:
[ -f config.conf ] && . config.conf
DaveQB is offline   Reply With Quote
Old May 18th, 2006, 9:08 AM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Ummm, this thread was just about a year old !?!? -- ?!?!?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old May 18th, 2006, 9:44 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Happy birthday, thread .
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 19th, 2006, 4:06 AM   #6
DaveQB
Newbie
 
DaveQB's Avatar
 
Join Date: Apr 2006
Location: Sydney
Posts: 14
Rep Power: 0 DaveQB is on a distinguished road
Send a message via ICQ to DaveQB Send a message via Skype™ to DaveQB
So it is. Found it on the first page so didn't think it would be any more then a few days old. I guess I need to get used to the pace of these forums.
DaveQB is offline   Reply With Quote
Old May 19th, 2006, 9:51 AM   #7
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Apparently, my original reply didn't go through... so here it is in summary.

--
I could see where that is a bit misleading. Fortunately, the other sections have a faster pace. Hopefully, we can spark some life back into this one.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old May 19th, 2006, 8:14 PM   #8
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
Quote:
Originally Posted by DaveQB
So it is. Found it on the first page so didn't think it would be any more then a few days old. I guess I need to get used to the pace of these forums.

Try the Lounge - it has about 90% of all the posts on the site..
And, Dawei has about 40% of all posts on the site. You do the math...

Because of the dearth of new threads, every new programming question gets jumped on right away. This is good for the questioner. Assuming he/she follows the Forum rules.
jim mcnamara is offline   Reply With Quote
Old May 19th, 2006, 8:21 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
That's FOUR percent, not FORTY :p . An' I ain' th' top poster .
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 20th, 2006, 2:17 PM   #10
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
The rate you're going, you will be soon. Wait until I get stuck into my exams... you'll blaze past me like a rat with its tail on fire.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC