Date: Sat, 2 Aug 2008 21:59:53 +0200 From: "Redd Vinylene" <reddvinylene@gmail.com> To: Polytropon <freebsd@edvax.de> Cc: questions@freebsd.org Subject: Re: Reducing 124 ifconfig lines in rc.conf to just 1 Message-ID: <f1019d520808021259q297d2cfbpb5cd41554476f773@mail.gmail.com> In-Reply-To: <20080802212437.e5a853c1.freebsd@edvax.de> References: <f1019d520808021211l2208ca86s7a66af15417d9de6@mail.gmail.com> <20080802212437.e5a853c1.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 2, 2008 at 9:24 PM, Polytropon <freebsd@edvax.de> wrote: > Hi! > > On Sat, 2 Aug 2008 21:11:47 +0200, "Redd Vinylene" <reddvinylene@gmail.com> wrote: >> Greetings! >> >> I got 124 ifconfig lines going from ifconfig_rl0_alias0="inet >> 80.252.2.3 netmask 255.255.255.255" to ifconfig_rl0_alias124="inet >> 80.252.2.127 netmask 255.255.255.255". >> >> Is it possible reducing it all to just 1 line using a for loop or jot >> or something? > > I'm thinking of a "two stage procedure" that can be implemented > well with /etc/rc.conf. Stupid idea, I know, but it should work, > allthough you could make it more tidy: > > # First create /etc/ifconfig.conf if not already there > if [ ! -f /etc/ifconfig.conf ]; then > echo "#!/bin/sh" > /etc/ifconfig.conf > ALIAS=0 > while [ ${ALIAS} -lt 125 ]; do > echo 'ifconfig_rl0_alias${ALIAS}="inet 80.252.2.`expr ${ALIAS} + 4` netmask 255.255.255.255" >> /etc/ifconfig.conf > ALIAS=`expr ${ALIAS} + 1` > done > fi > > # Now source it into /etc/rc.conf > . /etc/ifconfig.conf > > # Done. > > > -- > Polytropon > From Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... > That will probably work. Looks a bit messy though, I'll use it if nobody else knows of a simpler solution. Thanks! -- http://www.home.no/reddvinylene
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f1019d520808021259q297d2cfbpb5cd41554476f773>