echo ${host%%.}
}
-# NB 27.06.19 net_resolve() {
-# NB 27.06.19 (
-# NB 27.06.19 if [ -t 0 ]; then
-# NB 27.06.19 while [ $# -gt 0 ]; do
-# NB 27.06.19 printf '%s\n' "$1"
-# NB 27.06.19 shift
-# NB 27.06.19 done
-# NB 27.06.19 else
-# NB 27.06.19 cat
-# NB 27.06.19 fi
-# NB 27.06.19 ) | perl -MSocket -pe 'BEGIN{sub ip2host{$i=shift;return $c{$i} if $c{$i};$h=gethostbyaddr(inet_aton($i),AF_INET);%c=()if keys(%c)>10000;return $c{$i}=$h?$h:$i;};}; s/(\b)(\d+(?:\.\d+){3})(\b)/$1.ip2host($2).$3/ge'
-# NB 27.06.19 }
-
net_cdr2mask() {
# Number of args to shift, 255..255, first non-255 byte, zeroes
eval 'set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0'