<?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 help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026845#M718863</link>
    <description>Try,&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;expect "New password:" &lt;BR /&gt;send "$password$id\r" &lt;BR /&gt;expect "Re-enter new password:" &lt;BR /&gt;send "$password$id\r" &lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This ways the password will become $password$id which will be unique for that user.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Karthik S S</description>
    <pubDate>Fri, 18 Jul 2003 12:11:45 GMT</pubDate>
    <dc:creator>Karthik S S</dc:creator>
    <dc:date>2003-07-18T12:11:45Z</dc:date>
    <item>
      <title>Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026842#M718860</link>
      <description>I am new to the expect and am trying to write a small script which changes 100 user's password. I want the script read user ID and passwords form 2 files. I can only make the script change 100 user's password to same which is not i want.   &lt;BR /&gt;&lt;BR /&gt;Here's my scripts&lt;BR /&gt;set password [exec cat /tmp/passwords]                                               &lt;BR /&gt;set id [exec cat /tmp/id ]&lt;BR /&gt;foreach user $id {&lt;BR /&gt;   spawn passwd $user&lt;BR /&gt;   expect "New password:"&lt;BR /&gt;   send "$password\r"&lt;BR /&gt;   expect "Re-enter new password:"&lt;BR /&gt;   send "$password\r"&lt;BR /&gt;   expect "Passwd successfully changed"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;Christine</description>
      <pubDate>Thu, 17 Jul 2003 19:35:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026842#M718860</guid>
      <dc:creator>Christine Zhao</dc:creator>
      <dc:date>2003-07-17T19:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026843#M718861</link>
      <description>well, in your foreach loop your always using the same password ($password).  you'll need to reference the appropriate password for each user.&lt;BR /&gt;&lt;BR /&gt;given the lack of error checking, probably the quickest way of achiving this is by adding&lt;BR /&gt;lreplace $password 0 0 at the end of your loop.&lt;BR /&gt;this will remove the first element from the list.&lt;BR /&gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;send "$password\r" &lt;BR /&gt;expect "Passwd successfully changed" &lt;BR /&gt;lreplace $password 0 0&lt;BR /&gt;}</description>
      <pubDate>Thu, 17 Jul 2003 21:46:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026843#M718861</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-07-17T21:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026844#M718862</link>
      <description>Thank you for your help! I tried, it's still reference the same password for each user.&lt;BR /&gt;&lt;BR /&gt;Christine &lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 12:05:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026844#M718862</guid>
      <dc:creator>Christine Zhao</dc:creator>
      <dc:date>2003-07-18T12:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026845#M718863</link>
      <description>Try,&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;expect "New password:" &lt;BR /&gt;send "$password$id\r" &lt;BR /&gt;expect "Re-enter new password:" &lt;BR /&gt;send "$password$id\r" &lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This ways the password will become $password$id which will be unique for that user.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Karthik S S</description>
      <pubDate>Fri, 18 Jul 2003 12:11:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026845#M718863</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-07-18T12:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026846#M718864</link>
      <description>No, Still not working! wu wu wu :( &lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2003 13:32:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026846#M718864</guid>
      <dc:creator>Christine Zhao</dc:creator>
      <dc:date>2003-07-18T13:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026847#M718865</link>
      <description>instead of having two files, combine them into a single file&lt;BR /&gt;&lt;BR /&gt;paste -d " " file1 file2 &amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;this will create one file with a single space between the fields&lt;BR /&gt;&lt;BR /&gt;then for your expect script&lt;BR /&gt;&lt;BR /&gt;if {$argc == 0 || $argc &amp;gt; 1} {&lt;BR /&gt;   send_user "Usage: [file tail $argv0] filename\n"&lt;BR /&gt;   exit&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;set infile [lindex $argv 0]&lt;BR /&gt;&lt;BR /&gt;if {[file readable $infile] == 0} {&lt;BR /&gt;   send_user "*** error: cannot read name file \"$infile\", exit\n"&lt;BR /&gt;   exit&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;while { [gets $infile line] != 1) {&lt;BR /&gt;set idpwd [split $line "\ "]&lt;BR /&gt;set id [lindex $idpwd 0]&lt;BR /&gt;set pwd [lindex $idpwd 1]&lt;BR /&gt;send_user "id = $id, passwd = $pwd\n"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;in the split there is a blank (space) after the \.&lt;BR /&gt;&lt;BR /&gt;this should print each user id and password as it goes through the loop.  This way you can make sure the id and password is changing for each iteration.  Then you can easily add your code to change the user's password.</description>
      <pubDate>Sat, 19 Jul 2003 01:42:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026847#M718865</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-07-19T01:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026848#M718866</link>
      <description>What is the length of $password??? If it is 8 or more characted length then adding $id behind $password won't make any sense...&lt;BR /&gt;&lt;BR /&gt;Make $password 5 or less characters then add the user id to it ...&lt;BR /&gt;&lt;BR /&gt;-Karthik S S</description>
      <pubDate>Sat, 19 Jul 2003 05:53:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026848#M718866</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-07-19T05:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026849#M718867</link>
      <description>oops  hopefully you already caught my typo&lt;BR /&gt;&lt;BR /&gt;while { [gets $infile line] != 1) { &lt;BR /&gt;&lt;BR /&gt;the 1 should be a -1 or&lt;BR /&gt;&lt;BR /&gt;while { [gets $infile line] != -1) { &lt;BR /&gt;</description>
      <pubDate>Sat, 19 Jul 2003 21:30:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script-help/m-p/3026849#M718867</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-07-19T21:30:14Z</dc:date>
    </item>
  </channel>
</rss>

