Use Send command of Expect package

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Use Send command of Expect package
# 1  
Old 12-18-2007
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. Press Control B or Control x
4. Or it could be just type character from keyboard through my perl script in the application.

Please let me know how can i use send command for above mentioned functionalities.I need this information ASAP.

Even if there is any other option than Expect please let me know the commands or package

Any help is much appreciated.

Thanks & Regards,
# 2  
Old 12-19-2007
check if this is what you want
# 3  
Old 12-19-2007
Originally Posted by Yogesh Sawant
check if this is what you want

Hi Yogesh,

I am trying to install IO::Tty and Expect package but everytime it is giving me some problem of dependent packages.So i tried to install ppm on AIX but i couldnt as i am not very comfortable in working on unix platforms.

Please can you tell me on how to install and use Expect package.I have got information about Expect that ,it will take hexadecimal code (Ex.Press Enter key or tab ).

I need this information immediately..Expecting a quick reply.

# 4  
Old 12-19-2007
# 5  
Old 12-19-2007
Thank u very much for the link.
# 6  
Old 12-21-2007
Please tell me the send comamnd in Expect for keyboard inputs like pres sspacebar.UP and Down arrow keys.
I am searching in Google but not succeeded.
It is very urgent ..Please let me know.
# 7  
Old 12-23-2007
This only refers to the true expect (which is a subset of tcl) but you can spawn a shell and use the internal parsing debugger (exp_internal 1) to see the expect generated output of your inputs.

package require Expect

exp_internal 1
log_user 0
set timeout 1000

if {[catch {spawn [lindex $argv 0]} err]} {
puts "$err during exec of [lindex $argv 0]"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

To send ID and Password for each command using expect feature in bash script

Dear Tech Guys, I am trying to send some commands on the local server and it always asks for user name and password after each command. To serve the purpose I am using expect function as follows: #!/usr/bin/expect set timeout 20 spawn "./" expect "Please Enter UserName: "... (6 Replies)
Discussion started by: Xtreme
6 Replies

2. Shell Programming and Scripting

Expect command to send the user input enter or ctrl+c

Hey All, I am writing one script using expect, that script which is used in spawn will accepts only 1. Enter 2. Ctrl+c Press Control-C to exit, Enter to proceed. Could some one share some thoughts to send the above user inputs in linux expect block ? Thanks, Sam (0 Replies)
Discussion started by: SCHITIMA
0 Replies

3. Shell Programming and Scripting

How to use expect and send command in UNIX/Linux?

Hello Everyone, I am executing a unix script which logs into 50+ servers (netapp servers) and runs some commands and captures output locally. Below is the code snippet. file1.txt has names of all the remote servers where I am logging in. #!/bin/ksh #!/usr/bin/expect touch... (1 Reply)
Discussion started by: rahul2662
1 Replies

4. Shell Programming and Scripting

problem in automating "fdisk" command using send and expect

hi i want to automate fdisk command . i spawned a process containing fdisk command from a process and tried to send the options to fdisk promt from that process. but that spawed process is notstarting itself help me out trying for two days :wall: my code: #!/bin/bash echo... (5 Replies)
Discussion started by: jagak89
5 Replies

5. Shell Programming and Scripting

Passing values in expect package

i am having specific number of input( as per o/p of another script) say 10 like d1,d2,d3....d10 i want to pass these o/p to expect script.But i don't know how to do that the the input to the expect script should be like this /expect_script.exp $d1 $d2......$dn as this "dn" depends in... (6 Replies)
Discussion started by: sagar_1986
6 Replies

6. Emergency UNIX and Linux Support

Problem when trying to remove a package using rpm command - error: package is not installed

Hello, i have installed a package by using the command sudo rpm -i filepackage.rpm package filepackage is already installed when i try to remove it, i get an error saying "is not installed": sudo rpm -e filepackage.rpm error: package filepackage is not installed How can... (4 Replies)
Discussion started by: g_p
4 Replies

7. 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

8. Solaris

expect package is not invoked from cron

Hi, I am running some etl commands in the windows from shell script(from unix sun solaris 5.9) by using expect package .While running manually the script is working fine.While running from cron it is exiting the after successfully firing the ETL command(The control does not stop after firing... (1 Reply)
Discussion started by: megh
1 Replies

9. 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

10. 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
Login or Register to Ask a Question