<?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 Troubleshooting script that uses expect in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/troubleshooting-script-that-uses-expect/m-p/4152740#M63643</link>
    <description>Hi there --&lt;BR /&gt;&lt;BR /&gt;I am writing a script that is designed to automate the interactive responses that are user would enter to gain access to a remote server. I have expect installed on the local workstation, which in this case is a Fedora Core 2 system.&lt;BR /&gt;&lt;BR /&gt;The script consists of two parts. The first part references the expect file in question, while the second part is the expect file. Listed below are the two files:&lt;BR /&gt;&lt;BR /&gt;tps_expect script:&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt; &lt;BR /&gt;# This script will provide access to the tcs application which&lt;BR /&gt;# is located on the remote server.&lt;BR /&gt; &lt;BR /&gt;# First disable access control so that only the tps server can connect&lt;BR /&gt;# to this client.&lt;BR /&gt;xhost + &lt;REMOTE server="" ip="" address=""&gt;&lt;BR /&gt; &lt;BR /&gt;# Establish a telnet session with mcrs1. NOTE: The address in question is&lt;BR /&gt;# the address that mcrs1 has on the Partners network, and not the internal&lt;BR /&gt;# tcs network address. The syntax shown below is designed to prompt the&lt;BR /&gt;# operator for the appropriate username and password.&lt;BR /&gt; &lt;BR /&gt;expect start_pts.expect&lt;BR /&gt;&lt;BR /&gt;start_pts.expect script:&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;#!/bin/tcsh&lt;BR /&gt; &lt;BR /&gt;# This script runs in conjunction with the tps_expect script.&lt;BR /&gt;# It uses the expect utility to automate several interactive&lt;BR /&gt;# commands the user would normally enter.&lt;BR /&gt; &lt;BR /&gt;spawn telnet mcrs1&lt;BR /&gt;expect {&lt;BR /&gt;login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;Password: {tps&lt;BR /&gt;send "mypassword\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send setenv DIPSLAY &lt;LOCAL ip="" address=""&gt;:0.0\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send "exec cd /TCS_MGH/TPRRuntime/\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send "exec startTPR.pl\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;When I run the tps_expect script, here is the output that I encounter:&lt;BR /&gt;&lt;BR /&gt;Quote:&lt;BR /&gt;&lt;REMOTE ip="" address=""&gt; being added to access control list&lt;BR /&gt;spawn telnet &lt;REMOTE host=""&gt;&lt;BR /&gt;Trying &lt;REMOTE ip="" address=""&gt;...&lt;BR /&gt;Connected to &lt;REMOTE host=""&gt;.&lt;BR /&gt;Escape character is '^]'.&lt;BR /&gt;&lt;BR /&gt;HP-UX &lt;REMOTE host=""&gt; B.10.20 E 9000/785 (ttyp3)&lt;BR /&gt;&lt;BR /&gt;login: invalid command name "tps"&lt;BR /&gt;while executing&lt;BR /&gt;"tps"&lt;BR /&gt;invoked from within&lt;BR /&gt;"expect -nobrace login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}"&lt;BR /&gt;invoked from within&lt;BR /&gt;"expect {&lt;BR /&gt;login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}&lt;BR /&gt;}"&lt;BR /&gt;(file "start_pts.expect" line 8)&lt;BR /&gt;Can someone help me correct the syntax errors in question? Thanks&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/LOCAL&gt;&lt;/REMOTE&gt;</description>
    <pubDate>Thu, 28 Feb 2008 23:33:10 GMT</pubDate>
    <dc:creator>Andrew Kaplan</dc:creator>
    <dc:date>2008-02-28T23:33:10Z</dc:date>
    <item>
      <title>Troubleshooting script that uses expect</title>
      <link>https://community.hpe.com/t5/operating-system-linux/troubleshooting-script-that-uses-expect/m-p/4152740#M63643</link>
      <description>Hi there --&lt;BR /&gt;&lt;BR /&gt;I am writing a script that is designed to automate the interactive responses that are user would enter to gain access to a remote server. I have expect installed on the local workstation, which in this case is a Fedora Core 2 system.&lt;BR /&gt;&lt;BR /&gt;The script consists of two parts. The first part references the expect file in question, while the second part is the expect file. Listed below are the two files:&lt;BR /&gt;&lt;BR /&gt;tps_expect script:&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt; &lt;BR /&gt;# This script will provide access to the tcs application which&lt;BR /&gt;# is located on the remote server.&lt;BR /&gt; &lt;BR /&gt;# First disable access control so that only the tps server can connect&lt;BR /&gt;# to this client.&lt;BR /&gt;xhost + &lt;REMOTE server="" ip="" address=""&gt;&lt;BR /&gt; &lt;BR /&gt;# Establish a telnet session with mcrs1. NOTE: The address in question is&lt;BR /&gt;# the address that mcrs1 has on the Partners network, and not the internal&lt;BR /&gt;# tcs network address. The syntax shown below is designed to prompt the&lt;BR /&gt;# operator for the appropriate username and password.&lt;BR /&gt; &lt;BR /&gt;expect start_pts.expect&lt;BR /&gt;&lt;BR /&gt;start_pts.expect script:&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;#!/bin/tcsh&lt;BR /&gt; &lt;BR /&gt;# This script runs in conjunction with the tps_expect script.&lt;BR /&gt;# It uses the expect utility to automate several interactive&lt;BR /&gt;# commands the user would normally enter.&lt;BR /&gt; &lt;BR /&gt;spawn telnet mcrs1&lt;BR /&gt;expect {&lt;BR /&gt;login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;Password: {tps&lt;BR /&gt;send "mypassword\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send setenv DIPSLAY &lt;LOCAL ip="" address=""&gt;:0.0\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send "exec cd /TCS_MGH/TPRRuntime/\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;expect {&lt;BR /&gt;"$ " {&lt;BR /&gt;send "exec startTPR.pl\n"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;When I run the tps_expect script, here is the output that I encounter:&lt;BR /&gt;&lt;BR /&gt;Quote:&lt;BR /&gt;&lt;REMOTE ip="" address=""&gt; being added to access control list&lt;BR /&gt;spawn telnet &lt;REMOTE host=""&gt;&lt;BR /&gt;Trying &lt;REMOTE ip="" address=""&gt;...&lt;BR /&gt;Connected to &lt;REMOTE host=""&gt;.&lt;BR /&gt;Escape character is '^]'.&lt;BR /&gt;&lt;BR /&gt;HP-UX &lt;REMOTE host=""&gt; B.10.20 E 9000/785 (ttyp3)&lt;BR /&gt;&lt;BR /&gt;login: invalid command name "tps"&lt;BR /&gt;while executing&lt;BR /&gt;"tps"&lt;BR /&gt;invoked from within&lt;BR /&gt;"expect -nobrace login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}"&lt;BR /&gt;invoked from within&lt;BR /&gt;"expect {&lt;BR /&gt;login: {tps&lt;BR /&gt;send "username\n"&lt;BR /&gt;}&lt;BR /&gt;}"&lt;BR /&gt;(file "start_pts.expect" line 8)&lt;BR /&gt;Can someone help me correct the syntax errors in question? Thanks&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/REMOTE&gt;&lt;/LOCAL&gt;&lt;/REMOTE&gt;</description>
      <pubDate>Thu, 28 Feb 2008 23:33:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/troubleshooting-script-that-uses-expect/m-p/4152740#M63643</guid>
      <dc:creator>Andrew Kaplan</dc:creator>
      <dc:date>2008-02-28T23:33:10Z</dc:date>
    </item>
  </channel>
</rss>

