<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic expect scripting error in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130682#M8210</link>
    <description>I am trying to write an expect script that when it gets a certain prompt on&lt;BR /&gt;login it writes to a file to be mailed to me later....&lt;BR /&gt;I have the set variables at the beginning...&lt;BR /&gt;&lt;BR /&gt;set LOG_FILE /home/c/logs/pass_set.log&lt;BR /&gt;set FILE [open /home/c/scripts/problem_list.txt "r"]&lt;BR /&gt;set ERROR_FILE /home/c/logs/connect_errors1.txt&lt;BR /&gt;set ERROR [ open $ERROR_FILE "w"]&lt;BR /&gt;set LOGIN_ERROR_FILE /home/c/logs/failed_logins1.txt&lt;BR /&gt;set PASS_ERROR_FILE /home/c/logs/passwd_change_error1.txt&lt;BR /&gt;set PASS_ERROR [ open $PASS_ERROR_FILE "w"]&lt;BR /&gt;set MAILTO someone@work.com&lt;BR /&gt;set SUBJECT_CONNECT "Failed Connections for acc account on [exec date]"&lt;BR /&gt;set SUBJECT_PASSWD "Failed Passwd Changes for acc account on [exec date]"&lt;BR /&gt;&lt;BR /&gt;puts $ERROR "**** FAILED Connections ERROR LOG for [exec date] **** \n"&lt;BR /&gt;puts $PASS_ERROR "**** FAILED Passwd Changes ERROR LOG for [exec date] ****&lt;BR /&gt;\n"&lt;BR /&gt;&lt;BR /&gt;####################################&lt;BR /&gt;I then start the script that source a file of IPs, and logs in, this is&lt;BR /&gt;where I need to get the error of&lt;BR /&gt;Invalid user name or password.&lt;BR /&gt;&lt;BR /&gt;Here is chunks of the script...&lt;BR /&gt;####################################&lt;BR /&gt;&lt;BR /&gt;proc acc_login {} {&lt;BR /&gt;        send -- "acc1\r"&lt;BR /&gt;        expect "Enter Password\r\n&amp;gt;$"&lt;BR /&gt;        send -- "*************\r"&lt;BR /&gt;        expect -exact "************\r"&lt;BR /&gt;        expect  "Invalid user name or password.\*$"&lt;BR /&gt;        {&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        }&lt;BR /&gt;                        }&lt;BR /&gt;#####################################################&lt;BR /&gt;&lt;BR /&gt;This is the error when I run the script...&lt;BR /&gt;&lt;BR /&gt;Enter User Name&lt;BR /&gt;&amp;gt;acc1&lt;BR /&gt;Enter Password&lt;BR /&gt;&amp;gt;************&lt;BR /&gt;Invalid user name or password.&lt;BR /&gt;Enter User Name&lt;BR /&gt;&amp;gt;invalid command name "&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        "&lt;BR /&gt;    while executing&lt;BR /&gt;"{&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        }"&lt;BR /&gt;    (procedure "acc_login" line 7)&lt;BR /&gt;    invoked from within&lt;BR /&gt;"acc_login "&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 27 Nov 2003 21:00:42 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2003-11-27T21:00:42Z</dc:date>
    <item>
      <title>expect scripting error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130682#M8210</link>
      <description>I am trying to write an expect script that when it gets a certain prompt on&lt;BR /&gt;login it writes to a file to be mailed to me later....&lt;BR /&gt;I have the set variables at the beginning...&lt;BR /&gt;&lt;BR /&gt;set LOG_FILE /home/c/logs/pass_set.log&lt;BR /&gt;set FILE [open /home/c/scripts/problem_list.txt "r"]&lt;BR /&gt;set ERROR_FILE /home/c/logs/connect_errors1.txt&lt;BR /&gt;set ERROR [ open $ERROR_FILE "w"]&lt;BR /&gt;set LOGIN_ERROR_FILE /home/c/logs/failed_logins1.txt&lt;BR /&gt;set PASS_ERROR_FILE /home/c/logs/passwd_change_error1.txt&lt;BR /&gt;set PASS_ERROR [ open $PASS_ERROR_FILE "w"]&lt;BR /&gt;set MAILTO someone@work.com&lt;BR /&gt;set SUBJECT_CONNECT "Failed Connections for acc account on [exec date]"&lt;BR /&gt;set SUBJECT_PASSWD "Failed Passwd Changes for acc account on [exec date]"&lt;BR /&gt;&lt;BR /&gt;puts $ERROR "**** FAILED Connections ERROR LOG for [exec date] **** \n"&lt;BR /&gt;puts $PASS_ERROR "**** FAILED Passwd Changes ERROR LOG for [exec date] ****&lt;BR /&gt;\n"&lt;BR /&gt;&lt;BR /&gt;####################################&lt;BR /&gt;I then start the script that source a file of IPs, and logs in, this is&lt;BR /&gt;where I need to get the error of&lt;BR /&gt;Invalid user name or password.&lt;BR /&gt;&lt;BR /&gt;Here is chunks of the script...&lt;BR /&gt;####################################&lt;BR /&gt;&lt;BR /&gt;proc acc_login {} {&lt;BR /&gt;        send -- "acc1\r"&lt;BR /&gt;        expect "Enter Password\r\n&amp;gt;$"&lt;BR /&gt;        send -- "*************\r"&lt;BR /&gt;        expect -exact "************\r"&lt;BR /&gt;        expect  "Invalid user name or password.\*$"&lt;BR /&gt;        {&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        }&lt;BR /&gt;                        }&lt;BR /&gt;#####################################################&lt;BR /&gt;&lt;BR /&gt;This is the error when I run the script...&lt;BR /&gt;&lt;BR /&gt;Enter User Name&lt;BR /&gt;&amp;gt;acc1&lt;BR /&gt;Enter Password&lt;BR /&gt;&amp;gt;************&lt;BR /&gt;Invalid user name or password.&lt;BR /&gt;Enter User Name&lt;BR /&gt;&amp;gt;invalid command name "&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        "&lt;BR /&gt;    while executing&lt;BR /&gt;"{&lt;BR /&gt;           puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was&lt;BR /&gt;not changed."; continue&lt;BR /&gt;        }"&lt;BR /&gt;    (procedure "acc_login" line 7)&lt;BR /&gt;    invoked from within&lt;BR /&gt;"acc_login "&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Nov 2003 21:00:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130682#M8210</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2003-11-27T21:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: expect scripting error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130683#M8211</link>
      <description>Could you attach these sections of code from the source instead of pasting them in?&lt;BR /&gt;&lt;BR /&gt;The line-wrapping etc. makes it 'difficult' to be sure what the original says.</description>
      <pubDate>Thu, 27 Nov 2003 21:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130683#M8211</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-11-27T21:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: expect scripting error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130684#M8212</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I dont know this language but I wonder, if continue shouldnt be exp_continue?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Nov 2003 05:35:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130684#M8212</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-29T05:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: expect scripting error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130685#M8213</link>
      <description>On think I usually do with expect is use "autoexpect"  it writes the script for you basically.  &lt;BR /&gt;&lt;BR /&gt;man autoexpect for more details&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Dec 2003 12:29:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130685#M8213</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-12-01T12:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: expect scripting error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130686#M8214</link>
      <description>as for variables and such.... I've never used them in an expect script...</description>
      <pubDate>Mon, 01 Dec 2003 14:33:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/expect-scripting-error/m-p/3130686#M8214</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-12-01T14:33:03Z</dc:date>
    </item>
  </channel>
</rss>

