From owner-freebsd-jail@FreeBSD.ORG Sat Aug 2 18:07:35 2008 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C281106568C for ; Sat, 2 Aug 2008 18:07:35 +0000 (UTC) (envelope-from reddvinylene@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.185]) by mx1.freebsd.org (Postfix) with ESMTP id E145E8FC1B for ; Sat, 2 Aug 2008 18:07:34 +0000 (UTC) (envelope-from reddvinylene@gmail.com) Received: by mu-out-0910.google.com with SMTP id i2so1161370mue.3 for ; Sat, 02 Aug 2008 11:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=DN0LuGIqaozeMlWDtpWGbc9e2towiFvSpC1CFRLfljU=; b=sum5pHUEBx0AEl47IrzHMDDJuN7PTuxmvUUd0xM/LEdjvruira6hGtPeM+k4xXNnqS WCDMsInYVgE6657GiQZIUiclPAPLHAoKmBNQ4Gs+VH4jSVKtwsldf3kHPy67ETDqqG3h tDdltXiovzvakXygsZ/1JhPP426oyzcUKtFIY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=UuCFvy3WCNmNkJoZYgMf3tJP5LRzkf8ZQvu5upNSU7XVDueQHDrpqOAenogBy2kHVM 89tOSqwFz8yRMHniFN3XGdMMjmbACW7kYFhXzYAoVtwCjOZZxQW25yZfHyXvCY48DTfF MMT6OugaNZ67/gj+NhJ6sik/HTNve+TFvo2cU= Received: by 10.103.172.7 with SMTP id z7mr797901muo.40.1217700453540; Sat, 02 Aug 2008 11:07:33 -0700 (PDT) Received: by 10.103.199.5 with HTTP; Sat, 2 Aug 2008 11:07:33 -0700 (PDT) Message-ID: Date: Sat, 2 Aug 2008 20:07:33 +0200 From: "Redd Vinylene" To: "Matthew Seaman" In-Reply-To: <48949B5F.4070300@infracaninophile.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48949B5F.4070300@infracaninophile.co.uk> Cc: freebsd-jail@freebsd.org, questions@freebsd.org Subject: Re: jail_box_ip="" X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2008 18:07:35 -0000 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