6 raise 'Invalid Host' unless
7 host
=~
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
10 username
= $stdin.gets
.chomp
14 if username
=~
/^[0-9a-zA-Z_]+$/
16 # TODO: Errors produced by ssh client should be logged
18 # "host" is singular for a reason
19 known_host_file
= "~/.ssh/#{host}_known_host"
21 # -t is to force a pseudo-tty allocation
22 system("#{SSH} -t -t -o UserKnownHostsFile=#{known_host_file} " +
23 "#{username}@#{host}")
25 puts
"ERROR: Illegal username"
30 print
"Press the return key to restart..."