Sponsored Content
Full Discussion: Expect/Send
Top Forums Shell Programming and Scripting Expect/Send Post 302885734 by gowthamakanthan on Tuesday 28th of January 2014 07:06:42 AM
Old 01-28-2014
Expect/Send

Hello Team,

Am trying to write a script for installing PAM in mulitiple server by using expect and send command. Am facing the below issues,could you please assist. thanks.

Code:
[root]#  cat /tmp/gkscrpt.exp
#!/usr/bin/expect -d
spawn /tmp/agent/install_pam.sh
expect -re "(y/n) [y]"
send -- "y\r\n"
[root]# find / -name expect
/usr/bin/expect
[root]#  /tmp/gkscrpt.exp
expect version 5.43.0
argv[0] = /usr/bin/expect  argv[1] = -d  argv[2] = /tmp/gkscrpt.exp
set argc 0
set argv0 "/tmp/gkscrpt.exp"
set argv ""
executing commands from command file /tmp/gkscrpt.exp
spawn /tmp/agent/install_pam.sh
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {23661}
invalid command name "y"
    while executing
"y"
    invoked from within
"expect -re "(y/n) [y]""
    (file "/tmp/gkscrpt.exp" line 3)
[root@c28683735vl04 agent]#


Regards,
Gowtham.G
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect Send

Dear All, I wanna write a script in which it expect something and if it gets whats expected then send the command relating to that. for instance Userame: Asad Required Password for Asad: ****** I tried to use the expect key word but its does not work. I am using Solaris 8/9 If... (1 Reply)
Discussion started by: asadlone
1 Replies

2. Shell Programming and Scripting

replacing expect/send

Dear all, I have a code which needs to do : spawn ftp 10.4.12.22 expect "Name (10.4.12.22:mmsadmin):" send "BillingUser\r" expect "Password:" send "BillingUser\r" expect "ftp>" send "bye" but when i run its say spawn, send and expect is not found... how can i enable or install... (1 Reply)
Discussion started by: asadlone
1 Replies

3. Shell Programming and Scripting

Use Send command of Expect package

HI All, I am currently working on one command line application on AIX (Unix Platform).Here i need to use Expect package. By using Expect package at the top of the script,i want to use just Send command of Expect package to send characters like, 1. Press Enter key 2. Press spacebar 3.... (6 Replies)
Discussion started by: neha123
6 Replies

4. Shell Programming and Scripting

Is there a way to ask expect wait for sometime before running the next send command ?

Hi all, After expect catches the string I specify, is there a way to ask expect wait for sometime before running the next send command ? So my script looks like following, expect "some string" #How to ask expect to wait for a while send "next command" The reason I want to do this is... (0 Replies)
Discussion started by: qiulang
0 Replies

5. Shell Programming and Scripting

within shell script send expect and if else

Hi I have written one shell script , using that i am able to connect to remote machine but i have to #!/usr/bin/expect -f set address set username set password set OOLpath set dbusername set dbpasswd set tnsname set recdbusername set recdbpasswd set rectnsname spawn ssh... (1 Reply)
Discussion started by: mnmonu
1 Replies

6. Shell Programming and Scripting

within shell script send expect and if else

Hi, I have written one shell script , using that i am able to connect to remote machine but i have to #!/usr/bin/expect -f set address set username set password set OOLpath set dbusername set dbpasswd set tnsname set recdbusername set recdbpasswd set rectnsname spawn ssh... (2 Replies)
Discussion started by: mnmonu
2 Replies

7. Shell Programming and Scripting

scriping expect/send

Trying to script an application's interactive add-user function with expect/send. So far no information is sent, but the add-user function is called. Any help appreciated! Many Thanks #!/bin/sh #!/usr/bin/expect -f #PATH to add-user: PATH to expect PATH=/opt/app-1/sbin:/usr/bin ... (2 Replies)
Discussion started by: nolamiami
2 Replies

8. Shell Programming and Scripting

Command substitution in send/expect. Please help!

Hi, the following code is not working. How can I cat the last modified file in the path /asdf. Please help! expect "asdf%" {send "cat `ls -rt /asdf|tail -1` \r"} (2 Replies)
Discussion started by: thulasidharan2k
2 Replies

9. AIX

Send ctrl+C in expect script

Hi, Am trying to transfer file via FTP using expect script from server to client i need to interrupt the file transfer between server and client Please help what should used in expect code.. I used send "ctrl+c\r" expect "Aborted" but that didnt work.. I need what should... (3 Replies)
Discussion started by: Priya Amaresh
3 Replies

10. Shell Programming and Scripting

Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }"

Hi All, i am trying to ssh to a remote machine and execute certain command to remote machine through script. i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as expect: spawn id exp5 not open while executing "expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies
Email::Send::IO(3pm)					User Contributed Perl Documentation				      Email::Send::IO(3pm)

NAME
Email::Send::IO - Send messages using IO operations SYNOPSIS
use Email::Send; my $mailer = Email::Send->new({mailer => 'IO'}); $mailer->send($message); # To STDERR $mailer->mailer_args('filename.txt'); $mailer->send($message); # write file DESCRIPTION
This is a mailer for "Email::Send" that will send a message using IO operations. By default it sends mail to STDERR, very useful for debug- ging. The IO functionality is built upon "IO::All". Any additional arguments passed to "send" will be used as arguments to "IO::All::io". You can globally change where IO is sent by modifying the @Email::Send::IO::IO package variable. @Email::Send::IO::IO = ('-'); # always append to STDOUT. Examples Sending to STDOUT. send IO => $message, '-'; Send to a socket. send IO => $message, 'server:1337'; SEE ALSO
Email::Send, IO::All, perl. AUTHOR
Current maintainer: Ricardo SIGNES, <rjbs@cpan.org>. Original author: Casey West, <casey@geeknest.com>. COPYRIGHT
Copyright (c) 2005 Casey West. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.8 2007-07-29 Email::Send::IO(3pm)
All times are GMT -4. The time now is 06:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy