Yep, I just finished playing with it. My result I will put in the script
should be:
RANGE=`ipcalc $MYIP $MYMASK | grep Network | cut -d' ' -f 4 | cut -d/ -f 1`
On Thu, Oct 27, 2011 at 11:13 AM, Eric Shubert <
ejs@shubes.net> wrote:
> Brian's ipcalc looks like it might simplify things a bit. Nice.
>
>
> On 10/27/2011 10:57 AM, Dazed_75 wrote:
>
>> Thanks Eric. Those are what I was going to use before I had the thought
>> that someone might know of an already built function I could use rather
>> than me taking the IP and netmask apart, applying those, and
>> reassembling the IPrange. I suppose I've already wasted more time than
>> I would have saved. :)
>>
>> On Thu, Oct 27, 2011 at 10:28 AM, Eric Shubert <ejs@shubes.net
>> <mailto:ejs@shubes.net>> wrote:
>>
>> On 10/26/2011 09:49 PM, Dazed_75 wrote:
>>
>> I would like to apply a netmask to an arbitrary IP in a
>> bash/dash script
>> (e.g. apply 255.255.255.0 to 173.10.3.155 to get 173.10.3.0).
>> Is there
>> any easy way to do that without taking the IP apart, doing 4
>> operations
>> and reassembling the results?
>>
>> --
>> Dazed_75 a.k.a. Larry
>>
>> The spirit of resistance to government is so valuable on certain
>> occasions, that I wish it always to be kept alive.
>> - Thomas Jefferson
>>
>>
>> http://tldp.org/LDP/abs/html/_**_ops.html<http://tldp.org/LDP/abs/html/__ops.html>
>>
>> <http://tldp.org/LDP/abs/html/**ops.html<http://tldp.org/LDP/abs/html/ops.html>
>> >
>> See "bitwise operators" about half way down the page. I think that's
>> what you're looking for.
>>
>> --
>> -Eric 'shubes'
>>
>>
>> ------------------------------**__---------------------
>> PLUG-discuss mailing list - PLUG-discuss@lists.plug.__phoe**nix.az.us<http://phoenix.az.us>
>> <mailto:PLUG-discuss@lists.**plug.phoenix.az.us<PLUG-discuss@lists.plug.phoenix.az.us>
>> >
>>
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az._**_us/mailman/listinfo/plug-__**discuss
>>
>> <http://lists.PLUG.phoenix.az.**us/mailman/listinfo/plug-**discuss<http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss>
>> >
>>
>>
>>
>>
>> --
>> Dazed_75 a.k.a. Larry
>>
>> The spirit of resistance to government is so valuable on certain
>> occasions, that I wish it always to be kept alive.
>> - Thomas Jefferson
>>
>>
>
> --
> -Eric 'shubes'
>
> ------------------------------**---------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.**phoenix.az.us<PLUG-discuss@lists.plug.phoenix.az.us>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.**us/mailman/listinfo/plug-**discuss<http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss>
>
--
Dazed_75 a.k.a. Larry
The spirit of resistance to government is so valuable on certain occasions,
that I wish it always to be kept alive.
- Thomas Jefferson
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss