Write a bash script called broadcast_calc that will calculate the broadcast address for any given IP address and subnet mask. Your script should use arguments, variables, decisions and loops. 
Your script would work as follows

$ ./my_broadcast_calc 172.16.200.123/255.255.255.0

172.16.200.255

$ ./my_broadcast_calc 172.16.200.123/24

172.16.200.255

$ ./my_broadcast_calc 172.16.200.123/0xffffff00 -hex

0xac10c8ff

The script should be able to handle the option –hex (which means display the final output in hexadecimal format). If the option is not provided, the the script should always display the result as in decimal (base 10) format

 

 

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    • my_broadcastcalc.zip