[svlug] bash scripts - config files with comments?
Robert Citek
robert.citek at gmail.com
Fri Aug 17 15:26:12 PDT 2007
On 08/16/2007 04:32 PM, Robert Hajime Lanning wrote:
> 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
Avoiding sed:
while read LINE; do
LINE=${LINE%%#*}
[ -z "$LINE" ] && continue
: do what you want here
done < config-file
Regards,
- Robert
More information about the svlug
mailing list