Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Aug 2008 21:24:37 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "Redd Vinylene" <reddvinylene@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: Reducing 124 ifconfig lines in rc.conf to just 1
Message-ID:  <20080802212437.e5a853c1.freebsd@edvax.de>
In-Reply-To: <f1019d520808021211l2208ca86s7a66af15417d9de6@mail.gmail.com>
References:  <f1019d520808021211l2208ca86s7a66af15417d9de6@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080802212437.e5a853c1.freebsd>