Sponsored Content
Top Forums Shell Programming and Scripting Problem in sending inputs to format command using expect Post 302786411 by DGPickett on Wednesday 27th of March 2013 11:41:29 AM
Old 03-27-2013
What good is a partition of size zero?

Expect runs in tcl, as I recall, so there may be looping constructs in tcl you can include. The man page does not show and flow of control commands: Man Page for expect (all Section 0) - The UNIX and Linux Forums You could generate the expect script using a shell loop. You can generate it on the fly as a named pipe or with commands from stdin in interactive mode:

The -f flag prefaces a file from which to read commands from. The flag
itself is optional as it is only useful when using the #! notation (see
above), so that other arguments may be supplied on the command line.
(When using Expectk, this option is specified as -file.)

By default, the command file is read into memory and executed in its
entirety. It is occasionally desirable to read files one line at a
time. For example, stdin is read this way. In order to force arbi-
trary files to be handled this way, use the -b flag. (When using
Expectk, this option is specified as -buffer.)Notethatstdio-buffering-
maystilltakeplacehoweverthisshouldn'tcauseproblemswhenreadingfromafi-
foorstdin.

If the string "-" is supplied as a filename, standard input is read
instead. (Use "./-" to read from a file actually named "-".)

The -i flag causes Expect to interactively prompt for commands instead
of reading them from a file. Prompting is terminated via the exit com-
mand or upon EOF. See interpreter (below) for more information. -i is
assumed if neither a command file nor -c is used. (When using Expectk,
this option is specified as -interactive.)

-- may be used to delimit the end of the options. This is useful if
you want to pass an option-like argument to your script without it
being interpreted by Expect. This can usefully be placed in the #!
line to prevent any flag-like interpretation by Expect. For example,
the following will leave the original arguments (including the script
name) in the variable argv.

#!/usr/local/bin/expect --

Note that the usual getopt(3) and execve(2) conventions must be
observed when adding arguments to the #! line.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

2. Shell Programming and Scripting

Checking the format of inputs in a file

Hi, I have a script that takes the contents of another file as inputs. Its assumed that there are 3 values in the input file that are seperated by '|'. I have to check in my script, whether the filed seperator used in the input file is '|' or not. If its not a '|' I have to print a error... (13 Replies)
Discussion started by: sendhilmani123
13 Replies

3. UNIX for Advanced & Expert Users

better format for sending mail

i am using a script to create a file which contains the mail to be sent.in every steo this file grts appended through out the script using several variables.now i want to convert it into html format so that the mail will have better look and feel and the font color and size can be changed. i tried... (3 Replies)
Discussion started by: dr46014
3 Replies

4. Shell Programming and Scripting

Problem with while reading HTML inputs

Hi All, I am not able to read my HTML form inputs properly in my script. I have a textarea in my form where user needs to enter sql query... but when user enter query like below : select * from order_queue where NUM_OF_PICKUP >=3 and TRANSACTION_TYPE=4 ; its coming like : select 171_arc... (3 Replies)
Discussion started by: askumarece
3 Replies

5. Shell Programming and Scripting

Expect: run a command first before sending

Hello Expect experts, Is it possible with Expect to run a command first when an expected phrase is outputted by a spawned program? Before sending an answer to the spawned program that is... Thanks a lot. (2 Replies)
Discussion started by: Tr00tY
2 Replies

6. Shell Programming and Scripting

Query on sending inputs to a running application

Hi I need a help for below : I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the application connects to the server i am sending filename "accept.spb" as a parameter. DL385:$ ./XXXX This is XXXX (Reproducer by Order or RelaY) ... (1 Reply)
Discussion started by: srkelect
1 Replies

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

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

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

10. 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
runtest(1)						      General Commands Manual							runtest(1)

NAME
runtest - the DejaGnu test driver program SYNOPSIS
runtest [ options ] DESCRIPTION
DejaGnu is a framework for running test suites on GNU tools. It is written in expect, which uses Tcl (Tool command language). runtest is the test driver program; use it to control what tests to run, and variations on how to run them. You can find a comprehensive description of DejaGnu and runtest in The DejaGnu Testing Framework or its Info version, dejagnu.info. OPTIONS
--all Print all test output to screen. By default, only unexpected results are displayed. --baud rate Set the baud rate for a serial line connection. Some serial interface programs (like tip) don't use this value but instead use a separate initialization file. --connect type The type of connection to use. The choices are rlogin, telnet, rsh, kermit, tip and mondfe. --debug Turn on expect internal debugging output. All output is logged to a file called dbg.out. The output of the --strace also goes into this file. --help Prints out a help screen and then exits. --host type The configuration string for the host. --ignore test1.exp test2.exp ... Do not run the specified tests. --mail 'name1 name2 ...' Electronic mail addresses to receive test results. --name hostname The network hostname of the target board. --objdir path path is a directory containing compiled test code. --outdir directory The name of a directory for test log output. --reboot Reboot the target board when runtest initializes (if supported). --srcdir path path is a directory containing test directories. --strace N Turns on expect internal tracing to N levels deep. --target type The configuration string for the target. --tool toolname Specify the tool to be tested. toolname controls the test suite applied, and the associated initialization module. --verbose, -v Turns on more debugging output from test cases and DejaGnu utility code. Use more than once to increase output further. --version, -V Prints out the versions of DejaGnu, expect and Tcl. -D[number] Activate the Tcl debugger.number can be either 1 or 0. If it is 1, then the expect shell will break when it starts to run. All ^C's drop DejaGnu back to the debugger prompt. A 0 starts DejaGnu like normal, but a ^C drops to the debugger prompt. Any file name on the command line is assumed to be a subset of the test names to run. Usually these are the names of the expect test driver, ie... special.exp. Makefile style variables are used to specify tool names and their flags; these and other configuration dependent values are saved in the file site.exp, created during configuration. EXIT CODES
runtest sets the exit code to 1 if any of the tests failed, or sets it to 0 if all the tests passed. SEE ALSO
The DejaGnu Testing Framework (dejagnu.info). This is the DejaGnu manual; its source is the SGML files doc/*.sgml. in the DejaGnu distri- bution. AUTHOR
Rob Savoye (rob@welcomehome.org) 29 Jul 2003 runtest(1)
All times are GMT -4. The time now is 12:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy