<?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 Re: Expect script beginners help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053453#M719136</link>
    <description>a quoting hint&lt;BR /&gt;&lt;BR /&gt;variable substitution, command substitution, &lt;BR /&gt;and backslash substitution all occur as usual&lt;BR /&gt;inside of double quotes.&lt;BR /&gt;&lt;BR /&gt;variable substitution is triggered by a &lt;BR /&gt;dollar sign ($) character and causes the&lt;BR /&gt;value of a tcl variable to be inserted into&lt;BR /&gt;a word.&lt;BR /&gt;&lt;BR /&gt;sent "ll test.raw|awk '{print $5}'"&lt;BR /&gt;what is happening to $5</description>
    <pubDate>Thu, 21 Aug 2003 23:12:53 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-08-21T23:12:53Z</dc:date>
    <item>
      <title>Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053443#M719126</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to write an expect script that telnets into a server captures the size of a file within the server and then doe s a number of actions based on the size of the file. How do I capture this information. I know I do the following&lt;BR /&gt;&lt;BR /&gt;send -- "telnet 111.111.111.111\r"&lt;BR /&gt; do all of the login stuff&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;send -- "ls -l test.raw"&lt;BR /&gt;&lt;BR /&gt;how do I capture the response of this, also how can I use expect to write to a file on my system.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Thu, 21 Aug 2003 03:42:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053443#M719126</guid>
      <dc:creator>F_8</dc:creator>
      <dc:date>2003-08-21T03:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053444#M719127</link>
      <description>You can telnet to a box with password.&lt;BR /&gt;&lt;BR /&gt;(you can use remsh, or secure ssh to login without password)&lt;BR /&gt;&lt;BR /&gt;For sessions like telnet you can use utility expect to do this. Then you put your stuuf for file checking.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Thu, 21 Aug 2003 05:19:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053444#M719127</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-08-21T05:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053445#M719128</link>
      <description>Thanks, &lt;BR /&gt;&lt;BR /&gt;I'm actually more concerned with how I can isolate the size of the file and also analyse it using an if statement.&lt;BR /&gt;&lt;BR /&gt;ie if(filesize &amp;lt; 160) then (......)&lt;BR /&gt;else(&lt;BR /&gt;&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;but I'm not sure how I can get the size out of the string ie rwx--r-- directory directory 123 Aug 19 15:13 test.raw&lt;BR /&gt;&lt;BR /&gt;I hope you can help;</description>
      <pubDate>Thu, 21 Aug 2003 05:24:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053445#M719128</guid>
      <dc:creator>F_8</dc:creator>
      <dc:date>2003-08-21T05:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053446#M719129</link>
      <description>Thanks, &lt;BR /&gt;&lt;BR /&gt;I'm actually more concerned with how I can isolate the size of the file and also analyse it using an if statement.&lt;BR /&gt;&lt;BR /&gt;ie if(filesize &amp;lt; 160) then (......)&lt;BR /&gt;else(&lt;BR /&gt;&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;but I'm not sure how I can get the size out of the string ie rwx--r-- directory directory 123 Aug 19 15:13 test.raw&lt;BR /&gt;&lt;BR /&gt;I hope you can help;</description>
      <pubDate>Thu, 21 Aug 2003 05:24:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053446#M719129</guid>
      <dc:creator>F_8</dc:creator>
      <dc:date>2003-08-21T05:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053447#M719130</link>
      <description>ll test.raw|awk '{print $5}' --&amp;gt; to get the file size.</description>
      <pubDate>Thu, 21 Aug 2003 05:37:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053447#M719130</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-08-21T05:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053448#M719131</link>
      <description>set filesize [ file size yourFileName ]&lt;BR /&gt;&lt;BR /&gt;if $filesize &amp;lt; 160 {&lt;BR /&gt;do stuff&lt;BR /&gt;}</description>
      <pubDate>Thu, 21 Aug 2003 06:02:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053448#M719131</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-21T06:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053449#M719132</link>
      <description>write to a file:&lt;BR /&gt;&lt;BR /&gt;set file [open /dir/file w]&lt;BR /&gt;puts $file "Hello World"    ;# writes to /dir/file&lt;BR /&gt;close $file</description>
      <pubDate>Thu, 21 Aug 2003 06:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053449#M719132</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-21T06:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053450#M719133</link>
      <description>here is a nice tool.</description>
      <pubDate>Thu, 21 Aug 2003 16:21:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053450#M719133</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-08-21T16:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053451#M719134</link>
      <description>My expect script contains the following:&lt;BR /&gt;&lt;BR /&gt;send -- "telnet 111.111.111.111\r"&lt;BR /&gt;expect -exact "login:"&lt;BR /&gt;&lt;BR /&gt;send -- "username\r"&lt;BR /&gt;expect -exact "Password: "&lt;BR /&gt;&lt;BR /&gt;send -- "password\r"&lt;BR /&gt;expect -exact "\$"&lt;BR /&gt;&lt;BR /&gt;send -- "cd /home/username\r"&lt;BR /&gt;expect -exact "\$ "&lt;BR /&gt;&lt;BR /&gt;send -- "ls -l test.raw\r"&lt;BR /&gt;&lt;BR /&gt;ll test.raw|awk '{print $5}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When I run it I get the following result:&lt;BR /&gt;&lt;BR /&gt;$ can't read "5": no such variable&lt;BR /&gt;    while executing&lt;BR /&gt;"ll test.raw|awk '{print $5}'"&lt;BR /&gt;    (file "./script.exp" line 35)&lt;BR /&gt;&lt;BR /&gt;What have I done wrong?&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Aug 2003 22:12:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053451#M719134</guid>
      <dc:creator>F_8</dc:creator>
      <dc:date>2003-08-21T22:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053452#M719135</link>
      <description>the core of expect's language facilites are &lt;BR /&gt;provided by Tcl, a language used by many other tools.  Your scripts needs to use tcl's syntax.&lt;BR /&gt;&lt;BR /&gt;ll test.raw|awk '{print $5}' isn't in tcl's syntax. it is a unix shell command. they are not the same.&lt;BR /&gt;&lt;BR /&gt;this is probably more what your wanting to do&lt;BR /&gt;&lt;BR /&gt;expect -re "^.*$"&lt;BR /&gt;sent "ll test.raw|awk '{print $5}'"&lt;BR /&gt;set size $expect_out(0,string)&lt;BR /&gt;puts "file size = $size"&lt;BR /&gt;&lt;BR /&gt;when the matching string is finally typed&lt;BR /&gt;expect returns.  But, before returning, expect&lt;BR /&gt;stores the matched characters in a variable&lt;BR /&gt;called expect_out(0,string)</description>
      <pubDate>Thu, 21 Aug 2003 22:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053452#M719135</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-21T22:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script beginners help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053453#M719136</link>
      <description>a quoting hint&lt;BR /&gt;&lt;BR /&gt;variable substitution, command substitution, &lt;BR /&gt;and backslash substitution all occur as usual&lt;BR /&gt;inside of double quotes.&lt;BR /&gt;&lt;BR /&gt;variable substitution is triggered by a &lt;BR /&gt;dollar sign ($) character and causes the&lt;BR /&gt;value of a tcl variable to be inserted into&lt;BR /&gt;a word.&lt;BR /&gt;&lt;BR /&gt;sent "ll test.raw|awk '{print $5}'"&lt;BR /&gt;what is happening to $5</description>
      <pubDate>Thu, 21 Aug 2003 23:12:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-beginners-help/m-p/3053453#M719136</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-21T23:12:53Z</dc:date>
    </item>
  </channel>
</rss>

