I am trying to only have one of the if conditions to print.
subnet = ['10.14.1.32/27', '10.17.8.2/29']
system = gets.chomp
subnet.each do |cidr|
address_space = NetAddr::CIDR.create(cidr)
if address_space.contains? system
puts "found"
else
puts "not found"
end
end
the output I get for something like 10.17.8.3 would be
not found
found
How would I only get one response? I tried using breaks but that doesn't work. Thanks All!
subnet. Not sure what you expect