Ok... this is the new argument...
var HOME_NET [127.0.0.1/32,{
my ($A, $B, $C, $D) = split(/\./, $LocalIP);
my $mask = "$A\.$B\.$C\.0/24";
print $mask;
},{$ExternalIP}/32]
and what this generates is after an /sbin/e-smith/expand-template ...
var HOME_NET [127.0.0.1/32,1,24.85.12.224/32]
close... but no cigar..
I need the script to grab $LocalIP from /home/e-smith/configuration
and strip out the last group of digits (i.e. 192.168.1.1 needs to be 192.168.1)
I can add the .0/24 after the "}"
Now... if I change that script slightly to read:
var HOME_NET [127.0.0.1/32,{
my ($A, $B, $C, $D) = split(/\./, $LocalIP);
my $mask = "$A\.$B\.$C\/";
print $mask;
}.0/24,{$ExternalIP}/32]
Then the output in the conf file after expanding the template is:
var HOME_NET [127.0.0.1/32,1.0/24,24.85.12.224/32]
Now we're even closer...
What am I missing here (and thanks for the pointer int he right direction
Keith!)
Quoting Keith Woody <[EMAIL PROTECTED]>:
> ari,
> to replicate the below in perl:
>
> <script>
>
> #!/usr/bin/perl
>
> my ($A, $B, $C, $D) = split(/\./, $LocalIP);
> my $mask = "$A\.$B\.$C\.0/24";
> print $mask;
>
> </script>
>
> regards,
> -keith
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 01, 2002 12:00 PM
> Subject: [e-smith-devinfo] more about {$LocalIP}
>
>
> > In #!/bin/sh terms, what I'm trying to do is the following:
> > (Assuming that {$LocalIP}=192.168.1.1 in the
> /etc/e-smith/configuration
> file)
> >
> > A=`cat $LocalIP | awk -F"." {'print $1'}`
> > B=`cat $LocalIP | awk -F"." {'print $2'}`
> > C=`cat $LocaLIP | awk -F"." {'print $3'}`
> > echo $A"."$B"."$C".0/24"
> >
>
>
--
Please report bugs to [EMAIL PROTECTED]
Please mail [EMAIL PROTECTED] (only) to discuss security issues
Support for registered customers and partners to [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org