Sample Header Ad - 728x90

shell script if output equal any ip address

-1 votes
1 answer
1448 views
If $IP output equal to any ip address must print 1, else must print 0. #!/bin/sh IP=$(/usr/local/bin/dig ns.ripe.net. a +short) if [ $IP = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" ]; then echo 1 elif [ $IP != $ANY_IP ]; then echo 0 fi I need write script,which must check if "/usr/local/bin/dig ns.ripe.net. a +short" output return any ip address,should return 1,else return 0. The purpose of this script is to check dnssec. How can I denote any ip address for comparing?
Asked by David (369 rep)
Oct 10, 2018, 01:54 PM
Last activity: Dec 16, 2018, 11:46 AM