Re: bits from hex
From: Robert Bonomi (bonomi_at_c-ns.)
Date: 07/21/03
- Next message: joe_at_invalid.address: "c.u.s. FAQ, take two"
- Previous message: rakesh sharma: "Re: deleting text after string match"
- In reply to: ME: "bits from hex"
- Next in thread: ME: "Re: bits from hex"
- Reply: ME: "Re: bits from hex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 21 Jul 2003 00:11:08 GMT
In article <olASa.107120$ye4.79477@sccrnsc01>,
ME <trash.trash@comcast.net> wrote:
>I am not a keen on shell scripting so I am asking for some assistance. I
>have a firewall script that I have got to currently find the network mask of
>my main Interface (set to use DHCP). I would like to calculate the number
>of network bits from the mask. The mask I have retrieved from the interface
>is given in HEX. I assume there is probably an easy way to get this
>converted but I have no Idea how to do it. Does any one else have an idea
>(perferably using sh)?
>
>Thanks,
>
>Matt
>
>
run a loop 32 times that does the following:
if the netmask value is less than zero,
add one to network_bits_count
shift netmask left one bit.
when you fall out of that loop, you have the number of network bits.
even if they're not contiguous.
- Next message: joe_at_invalid.address: "c.u.s. FAQ, take two"
- Previous message: rakesh sharma: "Re: deleting text after string match"
- In reply to: ME: "bits from hex"
- Next in thread: ME: "Re: bits from hex"
- Reply: ME: "Re: bits from hex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|