loop do
end
else
store += 1
end
end
end
and you can simplify this even more:
def ask(msg)
loop do
print "#{msg} [y/n]: "
response = gets().strip
return true if response == ‘y’
return false if response == ‘n’
puts “Invalid response. Please enter y or n”
end
end
def find_device
puts “We are now trying to find the device”
Dir["/proc/scsi/usb-storage/*"].each do |usb_dev|
usb = File.read(usb_dev)
return usb if ask(“Found in #{usb_dev}: #{usb}. Is this your
device?”)
end && nil
end
procdata = find_device
cheers
Simon
p.s.: I have no /proc/scsi/usb-storage (win2000) so this is untested.