This is my simple expect scritpt:
#!/usr/bin/expect -f
match_max 100000
set timeout -1
spawn telnet $IP
expect "#"
send -- "shell\r"
expect "*Ready*"
send -- "init\r"
expect "*Ready*"
send -- "readsensor \r"
expect -- "*" <<< Output of this is a 2 digit number
set val... (5 Replies)
I have only some info into my buffer, but after a rssi command I see the folowing lines expected into buffer but not present :
rssi=-106
rssi=-109
I see in my buffer only the first part of the output, here you are a part of script :
#!/usr/bin/expect -f
#global expect_out
match_max 10000000... (1 Reply)
Greetings,
Having an issue with the expect_out(buffer). in a foreach loop through some switches I am grabbing some arp table information and writing it out to output files (1 each for each switch looped through).
The first iteration works fine. the second iteration of the loop writes the... (0 Replies)
Hi,
I am trying to write an expect script. Being a newbie in expect, maybee this is a silly doubt but i am stuck here.
So essentially , i want the o/p of one router command to be captured . Its something like this
Stats
Input Rx : 1234
Input Bytes : 3456
My expect script looks ... (5 Replies)
Hello "expect" experts
I am new at Expect. I have searched for a little while how to capture multiple lines with Expect and I am almost succeeded on that but I don't get all the lines of a command's output that the script executes on a server.
Here is how my script works in a nutshell -
... (6 Replies)
Can some one tell me how to flush expect_out(buffer)?
below is my code
expect -re {.*} {}
expect "swpackages>*"
send -i $con "trial.bat \r"
set outcome $expect_out(buffer)
expect "*continue*"
set prevreport $expect_out(buffer)
send "\r \r";
problem is :- I am getting "pre" stuffs... (0 Replies)
I have a code like this :
set ipv6_acl_max_chars test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_max_chars1234567890.01234aabcdob34567aBC0
spawn telnet $myip
expect "Login:" { send "admin\r" }
expect "Password:" {send "admin\r" }... (0 Replies)
trying to telnet to a device, list the files, and delete them. I can get the script to telnet and log in OK, and even issue the command to list out the files. I can't figure out how to parse the expect_out(buffer) and extract the file name for use in the delete command.
the files list out like... (4 Replies)
I have a expect file like this
#!/opt/tools/unsupported/expect-5.39/bin/expect
spawn ssh -l user ip
expect_after eof {exit 0}
set timeout 10
log_file /report.txt
expect "Password:" { send "pasword\r" }
expect "$ " { send "date\r" }
expect "$ " { send "readlink /somelink\r" }
set... (7 Replies)
Discussion started by: bebehnaz
7 Replies
LEARN ABOUT HPUX
opx25
opx25(1M)opx25(1M)NAME
opx25 - execute HALGOL programs
SYNOPSIS
scriptname] char] file-descriptor] file-descriptor] string]
DESCRIPTION
The commands, including are targeted for removal from HP-UX; see the below.
HALGOL is a simple language for communicating with devices such as modems and X.25 PADs. It has simple statements similar to and that are
described below.
Options
recognizes the following options:
Causes to read script as the input program. If is not specified, reads the standard input as a script.
Causes to use char as the first character in the input stream instead of actually reading it from the input descriptor.
This is useful sometimes when the program that calls is forced to read a character but then cannot ``unread'' it.
Causes to use number for the output file descriptor (i.e., the device to use for The default is 1.
Causes to use 'number' for the input file descriptor (ie, the device to use for 'expect'). The default is 0.
Causes to save this string for use when is encountered in a command.
Causes to turn on debugging mode.
Causes to turn on verbose mode.
An script file contains lines of the following types:
(empty) Empty lines are ignored.
Lines beginning with a slash
are ignored (comments)
ID ID denotes a label, and is limited to alphanumerics or
string must be surrounded by double quotes. The text is sent to the device specified by the option. Non-printable charac-
ters are represented as in C; i.e., as DDD, where DDD is the octal ascii character code. in a send string is the
string that followed the option.
Send a break "character" to the device.
Here number is how many seconds to wait before giving up. 0 means wait forever, but this is not advised. Whenever string
appears in the input within the time allotted, the command succeeds. Thus, it is not necessary to specify the entire
string. For example, if you know that the PAD will send several lines followed by an prompt, you could just use as
the string.
The program etc.) is run with the args specified. Do not use quotes here. Also, the program is invoked directly (using so wild
cards, redirection, etc. are not possible.
If the most recent expect or run encountered an error,
go to the label ID.
Similar to but does not fork.
Similar to but goes to standard error instead of to the device.
Sets the program in debug mode.
It echoes each line to as well as giving the result of each expect and run. This can be useful for writing new
scripts. The command disables this feature.
Sends subsequent incoming characters to
This can be used in the file as a security measure, because part of the incoming data stream contains the number of
the caller. There is a similar feature in it writes the time and the login name into the same logfile. The command
disables this feature.
Similar to but better in some cases because it sends only digits to the log file, and not other characters. The command dis-
ables this feature.
Sets a global timeout value.
Each expect uses time in the timeout reservoir; when this time is gone, the program gives up (exit 1). If this com-
mand is not used, there is no global timeout. Also, the global timeout can be reset any time, and a value of 0 turns
it off.
Exits with this value.
0 is success; anything else is failure.
To perform a rudimentary test of configuration files, run by hand, using the option followed by the name of the script file. then sends to
standard output and expects from standard input; thus you can type the input, observe the output, and use the command to see messages. See
the file for a good example of HALGOL programming.
WARNINGS
Use of commands, including is discouraged because they are targeted for removal from HP-UX. Use ftp(1) or rcp(1) instead.
AUTHOR
was developed by HP.
SEE ALSO getx25(1), uucp(1).
TO BE OBSOLETED opx25(1M)