[svlug] bash scripts - config files with comments?

Robert Hajime Lanning lanning at lanning.cc
Fri Aug 17 15:41:45 PDT 2007


<quote who="Robert Citek">
> 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

Me and my old style scripting... :)

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




More information about the svlug mailing list