Sponsored Content
Top Forums Shell Programming and Scripting Expect: run a command first before sending Post 302372815 by trey85stang on Wednesday 18th of November 2009 10:23:46 PM
Old 11-18-2009
I know the answer is yes, but I don't know expect well enough to tell you how to do it. It is based off of tcl if you happen to know how script/program in tcl/tk.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect and auto expect command

I need to run a remote application(GUI) in a client.i.e on running a script in the client machine i should get the GUI application which is running in the server by providing password through the script.Will expect or autoexpect command suit for this scenario? could anyone help me by posting some... (0 Replies)
Discussion started by: arun_v
0 Replies

2. Shell Programming and Scripting

Sending test pass to a folder in expect

still new to this expect useing bach shell to cammand expect script i tink i have that right! i want to have the test im running upon every complted cycle copyed to a folder. cant seem to get it to work. Ive tryed log_file -a $globallogdir/deveoper.log proc dbglog {notsure what... (0 Replies)
Discussion started by: melvin
0 Replies

3. Shell Programming and Scripting

Expect Script sending password with $ and symbols

All, I am trying to use expect to send SFTP password because I am unable to share a key with the vendor. They gave me a password that uses some symbols in it like $ and ! When i try to use the send command in expect it thinks the $ is a variable. Is there anyway to have it send the... (2 Replies)
Discussion started by: markdjones82
2 Replies

4. Shell Programming and Scripting

How to run the following expect commands in a loop

#!/usr/bin/expect spawn telnet 1.1.1.1 expect login* send “admin\r” expect Password* send “abcdef123\r” expect “Router#” send “exit\r” I want the above code to run in a loop such that script keeps doing a telnet to the device. Please suggest Tarun (1 Reply)
Discussion started by: tkhanna82
1 Replies

5. Shell Programming and Scripting

Use expect to run an interactive shell script?

Hi all, I have a bit of a vexing issue here and I'm not certain how best to go about it. Basically, I want to run a shell script and automate the user prompt of hitting 1 to fully uninstall Symantec Anti-Virus for OS X. Would expect be the best way to do this? (5 Replies)
Discussion started by: prometheon123
5 Replies

6. Shell Programming and Scripting

sending content of a file in Expect

How Can I send the content of a file in Expect? Do I have to use cat command in a way? if yes how? lets say my file is called 1.txt. example: expect "Enter command to send:" {send "???? \r"} ???? --> content of the file 1.txt (1 Reply)
Discussion started by: alireza6485
1 Replies

7. Shell Programming and Scripting

Cannot get this bash/expect script to run under a crontab

#!/bin/bash # # RAP configuration script # # Usage: ./rap.sh # # Requires: expect, tcl # # Script expects to find a file called rap.csv located in the same directory as the script. If the file is placed # in a different directory, modify the custom entries section to specify the absolute... (8 Replies)
Discussion started by: mrkool
8 Replies

8. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

9. Shell Programming and Scripting

Problem in sending inputs to format command using expect

Hi , I am not able figure out how to use expect tool to send input to this prompt of format Searching for disks...done selecting c0t3d0 FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition... (3 Replies)
Discussion started by: chidori
3 Replies

10. Shell Programming and Scripting

How to run the following expect commands in a loop?

spawn fbat expect ">>" send "log fbatPW80_OR8sim1 \r" expect ">>" send "load map.map \r" expect ">>" send "load fbatPW80_OR8sim1.ped \r" expect ">>" send "fbat -v1 \r" expect ">>" send "log off \r" expect ">>" I need the above code to run in a loop such that script keeps doing a... (1 Reply)
Discussion started by: zoeli
1 Replies
Test::Expect(3pm)					User Contributed Perl Documentation					 Test::Expect(3pm)

NAME
Test::Expect - Automated driving and testing of terminal-based programs SYNOPSIS
# in a t/*.t file: use Test::Expect; use Test::More tests => 13; expect_run( command => "perl testme.pl", prompt => 'testme: ', quit => 'quit', ); expect("ping", "pong", "expect"); expect_send("ping", "expect_send"); expect_is("* Hi there, to testme", "expect_is"); expect_like(qr/Hi there, to testme/, "expect_like"); DESCRIPTION
Test::Expect is a module for automated driving and testing of terminal-based programs. It is handy for testing interactive programs which have a prompt, and is based on the same concepts as the Tcl Expect tool. As in Expect::Simple, the Expect object is made available for tweaking. Test::Expect is intended for use in a test script. SUBROUTINES
expect_run The expect_run subroutine sets up Test::Expect. You must pass in the interactive program to run, what the prompt of the program is, and which command quits the program: expect_run( command => "perl testme.pl", prompt => 'testme: ', quit => 'quit', ); expect The expect subroutine is the catch all subroutine. You pass in the command, the expected output of the subroutine and an optional comment. expect("ping", "pong", "expect"); expect_send The expect_send subroutine sends a command to the program. You pass in the command and an optional comment. expect_send("ping", "expect_send"); expect_is The expect_is subroutine tests the output of the program like Test::More's is. It has an optional comment: expect_is("* Hi there, to testme", "expect_is"); expect_like The expect_like subroutine tests the output of the program like Test::More's like. It has an optional comment: expect_like(qr/Hi there, to testme/, "expect_like"); expect_handle This returns the Expect object. expect_quit Closes the Expect handle. SEE ALSO
Expect, Expect::Simple. AUTHOR
Leon Brocard, "<acme@astray.com>" COPYRIGHT
Copyright (C) 2005, Leon Brocard This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.12.3 2011-06-12 Test::Expect(3pm)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy