From owner-freebsd-questions@FreeBSD.ORG Sat Aug 2 19:52:22 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E4781065677 for ; Sat, 2 Aug 2008 19:52:20 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id CF7418FC13 for ; Sat, 2 Aug 2008 19:52:19 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-195-155-106.dynamic.qsc.de [92.195.155.106]) by mx02.qsc.de (Postfix) with ESMTP id EA66816C0050; Sat, 2 Aug 2008 21:24:38 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id m72JObKC003205; Sat, 2 Aug 2008 21:24:38 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sat, 2 Aug 2008 21:24:37 +0200 From: Polytropon To: "Redd Vinylene" Message-Id: <20080802212437.e5a853c1.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: Reducing 124 ifconfig lines in rc.conf to just 1 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 19:52:22 -0000 Hi! On Sat, 2 Aug 2008 21:11:47 +0200, "Redd Vinylene" 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, ...