ran into the same problem and after staring at the debug output for a while, moved the sending of the &quot;\r&quot;  to after the expect block.<br><br><br>    # we are logged in, now figure out the full prompt<br>#    send &quot;\r&quot;<br>
    expect {<br>        -re &quot;\[\r\n]+&quot;          { exp_continue; }<br>        -re &quot;^.+$prompt&quot;        { set junk $expect_out(0,string);<br>                                  regsub -all &quot;\[\]\[]&quot; $junk {\\&amp;} prompt;<br>
                                }<br>        -re &quot;^.+&gt; \\\(enable\\\)&quot;       {<br>                                  set junk $expect_out(0,string);<br>                                  regsub -all &quot;\[\]\[]&quot; $junk {\\&amp;} prompt;<br>
                                }<br>    }<br>    send &quot;\r&quot;<br><br>and that seemed to have the desired result.<br>