Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Aug 2008 21:16:04 +0200
From:      Lars Kristiansen <lars+lister.freebsd@adventuras.no>
To:        Redd Vinylene <reddvinylene@gmail.com>
Cc:        freebsd-jail@freebsd.org, questions@freebsd.org
Subject:   Re: jail_box_ip="<insert hundreds of ips here>"
Message-ID:  <4894B274.7060308@adventuras.no>
In-Reply-To: <f1019d520808021110w6bde456die3a843e6deaa069f@mail.gmail.com>
References:  <f1019d520808021008r55b83507ia755b945d95a4345@mail.gmail.com>	<48949B5F.4070300@infracaninophile.co.uk>	<f1019d520808021107i9d68b46y9742acb20ef9b5f7@mail.gmail.com> <f1019d520808021110w6bde456die3a843e6deaa069f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <reddvinylene@gmail.com> 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
>> <m.seaman@infracaninophile.co.uk> 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
>>
> 
> 
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4894B274.7060308>