On 02/06/2012 14:29, Hiroki Sato wrote:
> Doug Barton <[email protected]> wrote
>   in <[email protected]>:
> 
> do> On 02/06/2012 13:47, Hiroki Sato wrote:
> do> >  It actually depends on the newline
> do>
> do> That's way too fragile, as users are likely to put them all in one line
> do> since shell syntax doesn't differentiate (assuming non-wacky values of 
> IFS).
> 
>  I don't think so.  In this syntax a newline character is a separator
>  distinguished from normal white spaces by read statement.
> 
> do> > echo "$foo" | while read L; do echo $L; done

Ok, I was looking only at what you wrote in your last message, I forgot
what you're trying to accomplish.

Having thought more about this I still think that using rc.conf
variables for this is too fragile. Rather than introducing a new format
for rc.conf stuff what do you think about putting the new mechanism in
its own file? That way you can still use while/read to easily suck in
the free-form configuration stuff without creating something new for
rc.conf itself.

I'm thinking something along the lines of a default name of
/etc/ifconfig.$if, and the network.subr bits could do something like this:

if [ -n "$ifconfig_$IF" ]; then
        <do stuff>
elif [ -s "/etc/ifconfig.$IF" ]; then
        while read line ...
fi

You can add refinements such as if ifconfig_$IF contains a path name
that you use that file instead.


Doug

-- 

        It's always a long day; 86400 doesn't fit into a short.

        Breadth of IT experience, and depth of knowledge in the DNS.
        Yours for the right price.  :)  http://SupersetSolutions.com/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to