Calculating netmask in bash

Masks were meant to be used for a reason and not to hide behind. (c) Anthony T. Hincks

A subnet mask is a set of bits that determines how many bits are used to specify the subnet address and how many are used to specify the computer address within that subnet. It’s more common to see a subnet mask in decimal notation, but it’s actually represented in binary. If you understand how a subnet address and a computer address within that subnet are represented, you can easily determine the subnet address and subnet mask from the computer address and subnet mask, as follows: <subnet-address>/<number-of-bits> [Read More]

Script that works in Windows and Linux

There is no neat distinction between operating system software and the software that runs on top of it (c) Jim Allchin

When you work with computers that run different operating systems, such as Linux and Windows, then you probably have some similar tasks you execute in both of them. And for each operating system you write a separate script. Or may be you write programs in Java and for each operating system you have a script to set up an environment (sh-script or cmd-script). If you need to do basically the same in Windows and in Linux, you can write only one script, that will work in both operating systems. [Read More]