jail_box_ip="<insert hundreds of ips here>"
reddvinylene at gmail.com
Sat Aug 2 18:07:35 UTC 2008
jail_box_ip=$( jot -w "66.252.2.%d" -s "," 124 4 )
What a gorgeous solution ;)
On Sat, Aug 2, 2008 at 7:37 PM, Matthew Seaman
<m.seaman at 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
>> Like this?
>> 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
> 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
> jail_box_ip=$( jot -w "66.252.2.%d" -s "," 5 4 )
> Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
> Flat 3
> PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
> Kent, CT11 9PW
More information about the freebsd-questions