title: giving correct answer in expect script
body: <p>I want to configure <code>sensors-detect</code> automatically and remotely for 10 PC.
  The are some 'questions' that need to be answered without my interaction to those PC. These are 5 'questions' and my preferred answer:</p>
  
  <pre><code>Some south bridges, CPUs or memory controllers contain embedded sensors. 
  Do you want to scan for them? This is totally safe. (YES/no): 
  </code></pre>
  
  <p>The answer is <code>yes</code></p>
  
  <pre><code>Some Super I/O chips contain embedded sensors. We have to write to
  standard I/O ports to probe them. This is usually safe.
  Do you want to scan for Super I/O sensors? (YES/no):
  </code></pre>
  
  <p>The answer is <code>yes</code></p>
  
  <pre><code>Some hardware monitoring chips are accessible through the ISA I/O ports.
  We have to write to arbitrary I/O ports to probe them. This is usually
  safe though. Yes, you do have ISA I/O ports even if you do not have any
  ISA slots! Do you want to scan the ISA I/O ports? (YES/no): 
  </code></pre>
  
  <p>The answer is <code>yes</code></p>
  
  <pre><code>Some systems (mainly servers) implement IPMI, a set of common interfaces
  through which system health data may be retrieved, amongst other things.
  We first try to get the information from SMBIOS. If we don't find it
  there, we have to read from arbitrary I/O ports to probe for such
  interfaces. This is normally safe. Do you want to scan for IPMI
  interfaces? (YES/no):
  </code></pre>
  
  <p>The answer is <code>yes</code></p>
  
  <pre><code>Lastly, we can probe the I2C/SMBus adapters for connected hardware
  monitoring devices. This is the most risky part, and while it works
  reasonably well on most systems, it has been reported to cause trouble
  on some systems.
  Do you want to probe the I2C/SMBus adapters now? (YES/no):
  </code></pre>
  
  <p>The answer is <code>no</code></p>
  
  <p>The questions are asked in random manner even the '(yes/no)', some (YES/no) and some (yes/NO) depends on computer type. I've tried to automate this using Expect script:</p>
  
  <pre><code>spawn ssh $n2@node2
  
  expect "password:"
  send -- "$pa\r"
  expect -re $prompt
  send -- "echo $pa | sudo -S apt-get install lm-sensors\r"
  expect -re $prompt
  send -- "sudo sensors-detect\r"
  
  expect {
          "I2C/SMBus adapters now?"
          {   send -- "no\r"
              exp_continue
          }
      "Do you want to scan for them? This is totally safe."
          {   send -- "yes\r"
              exp_continue
          }
      "Super I/O sensors?"
          {   send -- "yes\r"
              exp_continue
          }
      "IPMI interfaces?"
          {   send -- "yes\r"
              exp_continue
          }
      "I/O ports?"
          {   send -- "yes\r"
              exp_continue
          }
  }
  
  expect "Just press ENTER to continue: "
  send -- "\r"
  expect "Do you want to add these lines automatically to /etc/modules? (yes/NO)"
  send -- "yes\r"
  expect -re $prompt
  send -- "sudo service kmod start\r"
  expect -re $prompt
  send -- "exit\r"
  expect eof
  </code></pre>
  
  <p>Unfortunately, the script wasn't answer it correctly and exit due to timeout. Some question was answered 3 times. This is the error: </p>
  
  <pre><code>Some south bridges, CPUs or memory controllers contain embedded sensors.
  Do you want to scan for them? This is totally safe. (YES/no): yes
  
  Some Super I/O chips contain embedded sensors. We have to write to
  standard I/O ports to probe them. This is usually safe.
  Do you want to scan for Super I/O sensors? (YES/no): yes
  
  Some systems (mainly servers) implement IPMI, a set of common interfaces
  through which system health data may be retrieved, amongst other things.
  We first try to get the information from SMBIOS. If we don't find it
  there, we have to read from arbitrary I/O ports to probe for such
  interfaces. This is normally safe. Do you want to scan for IPMI
  interfaces? (YES/no): yes
  
  Some hardware monitoring chips are accessible through the ISA I/O ports.
  We have to write to arbitrary I/O ports to probe them. This is usually
  safe though. Yes, you do have ISA I/O ports even if you do not have any
  ISA slots! Do you want to scan the ISA I/O ports? (yes/NO): yes
  yes
  yes
  yes
  
  Lastly, we can probe the I2C/SMBus adapters for connected hardware
  monitoring devices. This is the most risky part, and while it works
  reasonably well on most systems, it has been reported to cause trouble
  on some systems.
  Do you want to probe the I2C/SMBus adapters now? (YES/no): Sorry, no supported PCI bus adapters found.
  no
  </code></pre>