From owner-freebsd-questions@FreeBSD.ORG Sat Aug 2 19:32:07 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 45EFE10656C4; Sat, 2 Aug 2008 19:32:07 +0000 (UTC) (envelope-from lars+lister.freebsd@adventuras.no) Received: from mail.adventuras.no (mail.adventuras.no [194.63.250.215]) by mx1.freebsd.org (Postfix) with ESMTP id B66E38FC0A; Sat, 2 Aug 2008 19:32:06 +0000 (UTC) (envelope-from lars+lister.freebsd@adventuras.no) X-Adv-Watermark: 1218309373.913@FxOu1H9UVNxK4511aRTtHw Received: from ladyda.hovin.local (hjem [84.215.93.99]) (authenticated bits=0) by mail.adventuras.no (8.14.3/8.14.3) with ESMTP id m72JG4ZZ020298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 2 Aug 2008 21:16:10 +0200 (CEST) (envelope-from lars+lister.freebsd@adventuras.no) Authentication-Results: mail.adventuras.no; sender-id=none header.from=lars+lister.freebsd@adventuras.no; auth=pass (CRAM-MD5); spf=none smtp.mfrom=lars+lister.freebsd@adventuras.no Message-ID: <4894B274.7060308@adventuras.no> Date: Sat, 02 Aug 2008 21:16:04 +0200 From: Lars Kristiansen User-Agent: Thunderbird 2.0.0.16 (X11/20080727) MIME-Version: 1.0 To: Redd Vinylene References: <48949B5F.4070300@infracaninophile.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MailScanner-ID: m72JG4ZZ020298 X-Adventuras: du kan filtrere etter AdvSpamScore over 5-10 X-Adventuras-SpamCheck: not spam, SpamAssassin (not cached, score=-4.618, required 6, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.22, BAYES_00 -2.60) X-MailScanner-From: lars+lister.freebsd@adventuras.no X-Spam-Status: No Cc: freebsd-jail@freebsd.org, questions@freebsd.org Subject: Re: jail_box_ip="" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 19:32:07 -0000 Redd Vinylene skrev: > Can something similar be used for my > > ifconfig_rl0_aliasN="inet 66.252.2.N netmask 255.255.255.255" > > as well? > This is not as elegant, but may help in a similar way: alia=-1; while [ "$alia" -lt '123' ] ; do alia=$(($alia+1)) ; ips=$(($alia+4)) ; echo "ifconfig_rl0_alias$alia=\"inet 66.252.2.$ips netmask 255.255.255.255\"" ; done Regards Lars, arbeidsøkende, Oslo > On Sat, Aug 2, 2008 at 8:07 PM, Redd Vinylene wrote: >> jail_box_ip=$( jot -w "66.252.2.%d" -s "," 124 4 ) >> >> What a gorgeous solution ;) >> >> Thanks man! >> >> On Sat, Aug 2, 2008 at 7:37 PM, Matthew Seaman >> wrote: >>> Redd Vinylene wrote: >>>> Hey, I got a couple of hundred IPs, is there an easy way to add them >>>> all to jail_box_ip="ip1,ip2,ip3" without making like the longest line >>>> ever? >>>> >>>> Like this? >>>> >>>> jail_box_ip="66.252.2.4,\ >>>> 66.252.2.5,\ >>>> 66.252.2.6,\ >>>> >>>> Unfortunately that doesn't look too good. >>>> >>>> Nor does: >>>> >>>> export x=$(cat ips);export jail_ips=''; for ip in $x; do export >>>> jail_ips="$jail_ips,$ip"; done; export jail_ips=$(echo $jail_ips | sed >>>> s/,$/''/ | sed s/^,//); >>>> >>>> Is there a more beautiful alternative? >>> /etc/rc.conf is just /bin/sh code. All you need to do is set >>> the variables -- usually by assigning a static string, but you >>> can use whatever constructs you want. Well - within reason. Making >>> something as critical as the system boot process depend on a bunch of >>> other files or processes is not a good idea on the whole. >>> >>> You can include multi-line whitespace in the variables by using single >>> quotes: >>> >>> jail_box_ip='66.252.2.4, >>> 66.252.2.5, >>> 66.252.2.6, >>> 66.252.2.7' >>> >>> Assuming that the init script that processes this data isn't phased >>> by the inclusion of a bit of whitespace. >>> >>> Or you can generate the required numbers, assuming they are >>> consecutive: >>> >>> jail_box_ip=$( jot -w "66.252.2.%d" -s "," 5 4 ) >>> >>> Cheers, >>> >>> Matthew >>> >>> -- >>> Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard >>> Flat 3 >>> PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate >>> Kent, CT11 9PW >>> >>> >> >> >> -- >> http://www.home.no/reddvinylene >> > > >