10-19-2009
Expect script does not complete
I am new to Expect and need an expect script to expect data from a telnet session and respond with options as written in the script. There is no human input required. Problem is it gets to a point in the script and will just end. I have tried adjusting 'set timeout' and still does not help.
The code looks like this:
set timeout 30
match_max 2000
expect -timeout 3 -exact "Add Information"
expect -timeout 3 "THISWILLNOTBEFOUND"
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
-send -s <the data here is going through a series of input fields>
All of the data is input properly and the 'Add Information' screen is displayed again with a message that the data input had been successful.
I would like to <ENTER>, go to the next screen and continue with additional work. However, the script ends.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello to all...this is my first post (so please go easy). :)
I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
Does anyone know how to make BASH provide a list of possible completions on the first tab, and then start cycling through the possibilites on the next tab?
Right now this is what I have in my .bashrc:
bind "set show-all-if-ambiguous on"
bind \\C-o:menu-complete
This allows... (0 Replies)
Discussion started by: Mithu
0 Replies
3. Shell Programming and Scripting
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies
4. Programming
Hi,
Am very new to expect scripting..
Can You please suggest me how to call an expect script inside another expect script..
I tried with
spawn /usr/bin/ksh
send "expect main.exp\r"
expect $root_prompt
and
spawn /usr/bin/ksh
send "main.exp\r"
expect $root_prompt
Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies
5. Shell Programming and Scripting
I cant figure out how the complete function works in tcsh.
1. I whould like it to complete after writing my_program.py with either start or stop.
I have tried to do something like this in .cshrc.user:
complete my_program.py \
'c/start/' \
'c/stop/'
However i cant get it to... (1 Reply)
Discussion started by: mr_cad
1 Replies
6. Programming
I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues:
set REMOTE "/root/scripts/remote"
...
log_user 1
send_user "Executing remote script as $user...\n"
send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies
7. Shell Programming and Scripting
Hello,
I am in need of running an executable provided by a vendor that basically syncs files to a db. This tool can only be run against one folder at a time and it cannot have more than one instance running at a time. However, I need to run this tool against multiple folders. Each run of the... (5 Replies)
Discussion started by: vipertech
5 Replies
8. Shell Programming and Scripting
Hello gurus;
I need to do a script to complete a technical template and I don't have idea to how to do :wall: I've try with bash and awk or sed but my brain is empty in this script. I need help please.
The incoming file is a csv with an index number, first occurence in the possition of the... (2 Replies)
Discussion started by: renderuas
2 Replies
9. Programming
I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
... (0 Replies)
Discussion started by: IBGaryA
0 Replies
10. Shell Programming and Scripting
Hi,
I have a lengthy script which i have trimmed down for a test case as below.
more run.sh
#!/bin/bash
paths="allpath.txt"
while IFS= read -r loc
do
echo "Working on $loc"
startdir=$loc
find "$startdir" -type f \( ! -name "*.log*" ! -name "*.class*" \) -print |
while read file
do... (8 Replies)
Discussion started by: mohtashims
8 Replies
LEARN ABOUT SUSE
usb_control_msg
USB_CONTROL_MSG(9) USB Core APIs USB_CONTROL_MSG(9)
NAME
usb_control_msg - Builds a control urb, sends it off and waits for completion
SYNOPSIS
int usb_control_msg(struct usb_device * dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void * data,
__u16 size, int timeout);
ARGUMENTS
dev
pointer to the usb device to send the message to
pipe
endpoint "pipe" to send the message to
request
USB message request value
requesttype
USB message request type value
value
USB message value
index
USB message index value
data
pointer to the data to send
size
length in bytes of the data to send
timeout
time in msecs to wait for the message to complete before timing out (if 0 the wait is forever)
CONTEXT
!in_interrupt ()
DESCRIPTION
This function sends a simple control message to a specified endpoint and waits for the message to complete, or timeout.
If successful, it returns the number of bytes transferred, otherwise a negative error number.
Don't use this function from within an interrupt context, like a bottom half handler. If you need an asynchronous message, or need to send
a message from within interrupt context, use usb_submit_urb. If a thread in your driver uses this call, make sure your disconnect method
can wait for it to complete. Since you don't have a handle on the URB used, you can't cancel the request.
COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 USB_CONTROL_MSG(9)