Send ctrl+C in expect script


 
Thread Tools Search this Thread
Operating Systems AIX Send ctrl+C in expect script
# 1  
Old 08-29-2012
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 be given in expect script..
# 2  
Old 08-29-2012
You probably shouldn't use expect for this. Use the ksh coprocess facility instead. You can simply terminate the coprocess then by issuing kill -15 %1 or similar from the main process.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 3  
Old 08-29-2012
Do you mean while it is transferring the file? Why?
What are you trying to accomplish?
# 4  
Old 08-30-2012
Interrupt in FTP..

Am trying to check whether FTP abort works fine..
That why i need to interrupt the file transfer..
Because after interruption manually i got "Abort not understood by server"
So am trying to automate and use it for further test purposes..Smilie

---------- Post updated at 12:43 AM ---------- Previous update was at 12:42 AM ----------

Thanks Bakunin.. That worked.. Smilie
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 "./data1.sh" 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

Multiple expect/send statements not working in shell script

Hi I am trying the following in my bash script which logs into my machine and runs a command. Trying to solve this using expect. The first expect statement is hit and it enters the address "10.10.0.10" but when the second expect statement is hit it exits #!/bin/bash expect -c ' spawn... (2 Replies)
Discussion started by: skorada
2 Replies

4. Shell Programming and Scripting

Expect script error : send: spawn id exp4 not open

Hi, I am executing a expect script in while loop for doing telnet on list of servers stored in file as below : expect script : #!/usr/bin/expect -f set timeout 20 set ip set port if { == 0} { send_user "Usage: scriptname ip port\n" exit 1 } #exp_internal 1 log_user 0 spawn... (3 Replies)
Discussion started by: omkar.jadhav
3 Replies

5. Shell Programming and Scripting

Send ctrl-C signal using bash script.

declare -a array=( "LLC-load-misses" "LLC-loads" "LLC-store-misses" "LLC-stores" "branch-load-misses" "branch-loads" "dTLB-load-misses" "dTLB-loads" "dTLB-store-misses" "dTLB-stores" "iTLB-load-misses" "iTLB-loads" "branch-instructions" "branch-misses" "bus-cycles" "cache-misses" "cache-references"... (2 Replies)
Discussion started by: BHASKAR JUPUDI
2 Replies

6. Shell Programming and Scripting

Bash Script: Send files to SFTP using Expect

I have to send few gzipped files from local server to SFTP server. My Server Info Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise Created a bash script and could able to send files to sftp, but i want to send email if transfer is successful. ... (1 Reply)
Discussion started by: krux_rap
1 Replies

7. Shell Programming and Scripting

How to send Ctrl Break combination in Expect

Greetings, I am writing an Expect script to automate multiple processes on an HP-UX system. Everything has gone fine so far but I now have run into a problem. One of the processes that I'm trying to automate requires the key combination of ctrl break and I have so far been unable to figure out... (1 Reply)
Discussion started by: g_trueblood2000
1 Replies

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

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

10. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies
Login or Register to Ask a Question