
October 19th, 2011, 01:55 PM
|
|
|
It all depends on what you have, if anything, what you want and need in terms of usability (both in this script and also with any update function you may wish for).
A very simple way is to parse the config file using grep, looking for the keywords and then awk (or cut) to pull out the value. So, if your config file contained DAYS=8 on one line, you could use something like:
Code:
days=$(grep "^DAYS=" your_config_file | awk -F= '{print $2}')
days=${days:=10}
which would pull out the value in the config file, if found, and then assign a default value (of 10) if not value was found.
The location of the config file would be, of course, up to you and the script would also handle it not being found in a manner you decided - maybe by letting it fall through and use all the default values.
|