title: My scripts is erroring out as avikanch1 Venkat@4444 send: spawn id exp5 not open while executing "send "Venkat@4444\r""
body: <pre><code>#!/bin/bash
  user=`cat userdetails | cut -d "," -f1`
  user_pass=`cat userdetails | cut -d "," -f2`
  echo $user
  echo $user_pass
  
  /usr/bin/expect &gt; file.tmp &lt;&lt; EOF
          spawn passwd $user
          expect "New UNIX password:"
          send "$user_pass\r"
          expect "Retype new UNIX password:"
          send "$user_pass\r"
          expect "*#*"
  EOF
  </code></pre>