Méthode simple pour calculer le subnet en ksh

Written by admin on November 27, 2012 Categories: Ligne de commande, Linux, Network Tags: , ,

#!/bin/ksh
saveIFS=$IFS
IFS="."
ip=($1) mask=($2)
for i in {0..3} do
(( result[i] = ip[i] & mask[i] ))
done
echo "${result[*]}"
IFS=$saveIFS

Source :
http://stackoverflow.com/questions/3601513/shell-script-calculate-network-ip-by-shell-script

No Comments on Méthode simple pour calculer le subnet en ksh

Leave a Reply

Your email address will not be published. Required fields are marked *