Sponsored Content
Full Discussion: problem with expect eof
Operating Systems AIX problem with expect eof Post 302135140 by zoom on Thursday 6th of September 2007 06:12:58 AM
Old 09-06-2007
ok, now the script is followng

Code:
#!/usr/local/bin/expect -d

set timeout -1
set password 123
spawn passwd exptest
expect "*password:*"
sleep 1
send "$password\r"
expect "*password again:*"
sleep 1
send "$password\r"
expect eof

and again i cant control the shell

here is debug output, looks fine as for me :-)

Code:
# ./expp
expect version 5.43.0
argv[0] = /usr/local/bin/expect  argv[1] = -d  argv[2] = ./expp
set argc 0
set argv0 "./expp"
set argv ""
executing commands from command file ./expp
spawn passwd exptest
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {17710}

expect: does "" (spawn_id exp4) match glob pattern "*password:*"? no
Changing password for "exptest"
exptest's New password:
expect: does "Changing password for "exptest"\r\nexptest's New password: " (spawn_id exp4) match glob pattern "*password:*"? yes
expect: set expect_out(0,string) "Changing password for "exptest"\r\nexptest's New password: "
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "Changing password for "exptest"\r\nexptest's New password: "
send: sending "123\r" to { exp4 }

expect: does "" (spawn_id exp4) match glob pattern "*password again:*"? no

Enter the new pa
expect: does "\r\nEnter the new pa" (spawn_id exp4) match glob pattern "*password again:*"? no
ssword again:
expect: does "\r\nEnter the new password again:" (spawn_id exp4) match glob pattern "*password again:*"? yes
expect: set expect_out(0,string) "\r\nEnter the new password again:"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "\r\nEnter the new password again:"
send: sending "123\r" to { exp4 }

expect: read eof
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "\r\n"

maybe something wrong with my AIX...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

EOF creating problem

In shell file, i am writing following statement: cat > File1.sh <<EOF set feedback off set serveroutput on cat > File2.sh <<EOF contents of second file EOF Contents of First file EOF Actually, i want these bolded statements in File1.sh as it. But after first EOF, contents are... (1 Reply)
Discussion started by: mmunir
1 Replies

2. AIX

Problem with expect.

Hi, I am facing a strange problem while executing a script from a solaris server. This script calls another one to execute "expect" commands on some other 40 servers (all AIX 5200). I am passing username and password to the "expect" script as arguments. My problem is that it is showing the... (4 Replies)
Discussion started by: gsabarinath
4 Replies

3. Shell Programming and Scripting

confused with << EOF EOF

Hi friends , I am confused with << EOF EOF Most of the cases I found sqlplus $db_conn_str << EOF some sql staments EOF another exapmle is #!/bin/sh echo -n 'what is the value? ' read value sed 's/XXX/'$value'/' <<EOF The value is XXX EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies

4. Shell Programming and Scripting

expect problem

hi all, guys i have a problem in this code... any help ? #!/usr/bin/expect if { $argc != 3 } { puts "Usage:" puts "$argv0 username oldpwd newpwd" exit } #set machine set username set oldpwd set newpwd set completed_list " " (2 Replies)
Discussion started by: b1sh0p
2 Replies

5. UNIX for Dummies Questions & Answers

Problem in Expect

Hi Im writing an expect program for automating ftp. Having trouble with mget: expect "ftp>" {send "mget *.txt\r"} expect "mget*?" {send "n\r" ; expect_continue} expect "ftp>" {send "bye\r"} But expect even on ftp prompt "n" gets sent Please help... (1 Reply)
Discussion started by: crackle1985
1 Replies

6. Shell Programming and Scripting

EOF problem

hi i am trying to connect to database by two method one is sqlplus fss_blf/fss_blf@schema1 >select * from schema1_ta_example exit above method succesfffuly connect it to dabase but the problem comes when i try to enter this code into mine shell script by using EOF character it is... (4 Replies)
Discussion started by: aishsimplesweet
4 Replies

7. UNIX for Dummies Questions & Answers

EOF problem with Cron Job?

Hey guys... first post here... I have set up the following cron to create daily backups for me and rotate them weekly: date=`date +%d`; tar -zcvf /home/mysite/backups/backup_dev_$date.tgz /home/mysite/public_html/dev/app --exclude=/home/mysite/public_html/dev/app/tmp However, I keep... (4 Replies)
Discussion started by: Crazy Serb
4 Replies

8. Shell Programming and Scripting

problem with expect

i have written simple expect script but it doesnt work the way that i want can someone suggest wat is the issue? #!/usr/bin/expect spawn ssh abc@abc expect "password:" send "xyz\r" expect "$" send "mkdir hello\r" #sleep 10 #exit 0 output --------------- it does not create directory... (4 Replies)
Discussion started by: bkumar82
4 Replies

9. Shell Programming and Scripting

Problem with expect script

expect { -re "(.*)NEXT PAGE(.*)" { send "\r\n" } exp_continue (0 Replies)
Discussion started by: sagar_1986
0 Replies

10. Shell Programming and Scripting

Bash expect problem

Hey there :) I have a Bash Script and I'm trying to update Roundcube, but theres a user interactive line like: bin/installto.sh /var/www/mail/rc Upgrading from 1.1.3. Do you want to continue? (y/N) I'm trying to avoid this user interaction like this: cd roundcubemail-1.2.1 >/dev/null... (5 Replies)
Discussion started by: Aeris
5 Replies
VIPW(8) 						      System Manager's Manual							   VIPW(8)

NAME
vipw - edit the password file SYNOPSIS
vipw DESCRIPTION
Vipw edits the password file while setting the appropriate locks, and does any necessary processing after the password file is unlocked. If the password file is already being edited, then you will be told to try again later. The vi editor will be used unless the environment variable EDITOR indicates an alternate editor. Vipw performs a number of consistency checks on the password entries, and will not allow a password file with a ``mangled'' entry to be installed. If vipw rejects the new password file, the user is prompted to re-enter the edit session. Once the information has been verified, vipw uses mkpasswd(8) to update the user database. This is run in the background, and, at very large sites could take several minutes. Until this update is completed, the password file is unavailable for other updates and the new information will not be available to programs. SEE ALSO
chpass(1), passwd(1), passwd(5), adduser(8), mkpasswd(8) 4th Berkeley Distribution March 11, 1989 VIPW(8)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy