1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/bin/bash program=./cidrchk args="$@" if [ -z "$args" ]; then echo "No CIDR range(s) defined" exit 1 fi $program $args retval=$? case "$retval" in 0) echo "On net" ;; 1) echo "Off net" ;; 2) echo "Module import failure detected" ;; 3) echo "No network interfaces detected" ;; *) echo "Unknown failure" ;; esac