Ping a range of IP addresses
(1..254).each {|i| puts ": found 192.168.1.#{i}" if `ping 192.168.1.#{i} -c 1 -w 1`.match(/ttl/) }
DZone Snippets > jrobertson > range
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
James Robertson http://www.r0bertson.co.uk
(1..254).each {|i| puts ": found 192.168.1.#{i}" if `ping 192.168.1.#{i} -c 1 -w 1`.match(/ttl/) }