[kwlug-disc] BASH script and config file

Chris Frey cdfrey at foursquare.net
Fri Apr 24 23:09:28 EDT 2009

On Fri, Apr 24, 2009 at 05:03:43PM -0400, Richard Weait wrote:
> I added my filename at the end of the egrep and changed the \b to \w to
> get rid of a couple of blank lines from my test config file.  
> Wow 23 minutes.  Free Software communities are great.

Another method of specifying config information in shell scripts that
I like to use, is to use bash's parsing itself.

For example, using bash syntax:

---------- script.conf -----------

# This is a sample config file

# Directory where output goes

# Today's date in preferred format
TODAY=$(date +%Y%m%d)


Then just source the config file in your script:

----------- script.sh --------------

. /etc/script.conf

echo "Today is: $TODAY"


- Chris

More information about the kwlug-disc mailing list