Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2002 14:59:46 +0200 (MEST)
From:      Paul Everlund <tdv94ped@cs.umu.se>
To:        BSD Freak <bsd-freak@mbox.com.au>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Getting network and broadcast addresses in a shell script
Message-ID:  <Pine.GSO.4.44.0206041455260.3861-100000@gren.cs.umu.se>
In-Reply-To: <dd3f13dcfdec.dcfdecdd3f13@mbox.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Jun 2002, BSD Freak wrote:

> Hi all,
>
> I have the following shell script I am writing in which I need to get
> the $network and $broadcast:
>
> #!/bin
> netmask=255.255.255.0
> ip=192.168.0.1
>
> network=`do some magic with $netmask and $ip`
> broadcast=`do some more magic with $netmask and $ip`
>
> echo $network
> echo $broadcast
>
> Can anyone help me with the magic?

Magic is the word, as at least I do not know what you want to do,
so if I did manage to help you out, it would be just magic. :-)

Do you want to extract your computer's ip-address and broadcast
address from ifconfig, and then do magic stuff? In your example
it seems that you've already chosen both ip and netmask.

Best regards,
Paul


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.44.0206041455260.3861-100000>