[svlug] bash scripts - config files with comments?

Robert Hajime Lanning lanning at lanning.cc
Fri Aug 17 12:55:39 PDT 2007


<quote who="Paul Reiber">
> Might I ask why?  sourcing a separate configuration file seems to
> be exactly what you're looking for, and the shell's parser can
> ignore comment lines and white space issues, which is what you
> asked for.

He was asking for something to make the config file (which will be
edited a lot) as simple as /etc/hosts.  No complex shell syntax.

<quote who="Florin Andrei">
> hosts=( ${hosts[@]} "machine1" )
> hosts=( ${hosts[@]} "machine2" )
>
> See the problem? Instead of just adding a line with only
> "machine1", I have to use this nasty complex syntax.

If he wants the config file to look like this:
------------------
host1
host2

#host3

# this is a special host
host4
------------------

So, taking that in mind, you basically have to create a routine
to process the custom format.

-- 
And, did Galoka think the Ulus were too ugly to save?
                                         -Centauri




More information about the svlug mailing list