Multiple services per interface (Was: Re: Hotplug can bring up/down interfaces now)

Kevin P. Fleming kpfleming at linuxfromscratch.org
Tue Jul 6 20:14:37 PDT 2004


Bryan Kadzban wrote:

> Wait, I can do it with another loop.  With SERVICE and IFS set up:
> 
> for svc in $SERVICE
> do
>     # Add on to the beginning: reverse the string
>     REVSVC="$svc,$REVSVC"
> done
> 
> # Remove the final pesky comma
> REVSVC=${REVSVC%,}

Yes, this is the proper method, although when you're building REVSVC you 
might as well use space delimiters; you won't need to trim the end, you 
won't have to have IFS set to anything special. It's not likely that 
someone would actually have a service name that contains a space :-)

For that matter, I wouldn't be opposed to not using commas in the 
SERVICE variable either; I don't see a big difference between:

SERVICE=static,ipx,pppoe

and

SERVICE="static ipx pppoe"

except that the parsing logic is a bit simpler (no messing with IFS).



More information about the lfs-dev mailing list