Date: Sat, 02 Aug 2008 18:37:35 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> 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: <48949B5F.4070300@infracaninophile.co.uk> In-Reply-To: <f1019d520808021008r55b83507ia755b945d95a4345@mail.gmail.com> References: <f1019d520808021008r55b83507ia755b945d95a4345@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9ECDFE44CF1717F897ADFB13 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Redd Vinylene wrote: > Hey, I got a couple of hundred IPs, is there an easy way to add them > all to jail_box_ip=3D"ip1,ip2,ip3" without making like the longest line= > ever? >=20 > Like this? >=20 > jail_box_ip=3D"66.252.2.4,\ > 66.252.2.5,\ > 66.252.2.6,\ >=20 > Unfortunately that doesn't look too good. >=20 > Nor does: >=20 > export x=3D$(cat ips);export jail_ips=3D''; for ip in $x; do export > jail_ips=3D"$jail_ips,$ip"; done; export jail_ips=3D$(echo $jail_ips | = sed > s/,$/''/ | sed s/^,//); >=20 > 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=20 quotes: jail_box_ip=3D'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=3D$( jot -w "66.252.2.%d" -s "," 5 4 ) Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enig9ECDFE44CF1717F897ADFB13 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkiUm2oACgkQ8Mjk52CukIxPfQCgicUz6ZnHAMgR6W6XLFcFlDdU NKQAn2U0jJauJIAvei1Bug3aQ95RcuPa =A+Wv -----END PGP SIGNATURE----- --------------enig9ECDFE44CF1717F897ADFB13--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48949B5F.4070300>