[svlug] bash scripts - config files with comments?
Robert Hajime Lanning
lanning at lanning.cc
Thu Aug 16 14:32:43 PDT 2007
<quote who="Florin Andrei">
> So, is there a way to use "real", flexible config files from within a
> bash script?
> What I need is to specify a list of things, one element per line, and
> be able to comment out lines, add empty lines (that get ignored), be
> able to mistakenly add TAB or SPACE to the lines and not get
> punished for it, etc.
> The main script would parse the list into an array or something like
> that.
while read LINE; do
LINE="`echo "$LINE" | sed -e 's/#.*$//' -e 's/^\s\s*//' \
-e 's/\s\s*$//'`"
if [ -n "$LINE" ]; then
: do what you want here
fi
done < config-file
--
And, did Galoka think the Ulus were too ugly to save?
-Centauri
More information about the svlug
mailing list