Expect not functioning


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Expect not functioning
# 1  
Old 11-16-2012
Expect not functioning

Hello,

I plan on building an expect script and a ksh script to acquire some information and pass to the expect script. I'm very new with expect and figured I would start off slow. However, I use the spawn telnet command, run the script, and it prints out "spawn telnet" rather than doing anything. I'm working for a company that uses expect and have scripts in place already that work using the commands I'm using. Any help is greatly appreciated...below is some information about what I'm doing/getting.

Code:
<OLD>/Testfiles# ll test1.exp
-rwxrwx--- 1 root system 58 Nov 16 10:25 test1.exp
 
<OLD>/Testfiles# cat test1.exp
#!/usr/local/bin/expect -f
spawn telnet [lindex $argv 0]
 
<OLD>/Testfiles# ./test1.exp hello
spawn telnet hello
 
<OLD>/Testfiles# which expect
/usr/local/bin/expect
 
<OLD>/Testfiles# ll /usr/local/bin/expect
-rwx------ 1 root system 288083 Oct 20 2008 /usr/local/bin/expect
 
<OLD>/Testfiles#


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by radoulov; 11-23-2012 at 11:32 AM..
# 2  
Old 11-16-2012
What's your system?
# 3  
Old 11-16-2012
System

I'm using AIX 5.3 The other expect scripts are handled by cron.
# 4  
Old 11-23-2012
I came across the debug command, exp_internal 1, and now get the following...

Code:
<OLD>/Testfiles# ./test1.exp hello
spawn telnet hello
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {57878}

---------- Post updated at 02:14 PM ---------- Previous update was at 09:27 AM ----------

I added "interact" command to the end of my script, and it runs...so it seems that expect just had nothing to do.

I'd feel like a newbie, but it seems everyone else has the information gap too.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

Failed to read from eventlog: 31: A device attached to the system is not functioning.

Hello Team, I am getting below error on nagios to monitor windows Server 2012. Failed to read from eventlog: 31: A device attached to the system is not functioning. basically we are monitoring Eventlog file for server reboot or unexpected shutdown. Could you please help here. What could be... (0 Replies)
Discussion started by: ghpradeep
0 Replies

2. Programming

Expect script returning string following a found expect.

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

3. Red Hat

Functioning of 'cat' command

I need to display file, given on the command line to 'stdout' in Linux( not in red-hat )..Just like how 'cat' command is working! Basically I need to develop that command's coding part! Can somebody suggest some algorithm? (2 Replies)
Discussion started by: Mathew Antony
2 Replies

4. Shell Programming and Scripting

cp command not functioning regularly

I have written a korn shell script . I copy a file from one mounted directory to other using cp command. This script runs daily at a time. But sporidally it fails to copy the files. So I have missing files at the destination directory for some days. Is my method a good one or is there some... (5 Replies)
Discussion started by: Golden Egg
5 Replies

5. Programming

Calling expect script inside another expect

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

6. Linux

Pacman not functioning in Arch

Currently in a fresh install of arch linux and I have been trying to install some stuff with pacman. Every operation returns multiple errors such as no address record when using -Sy and unable to retrieve file when trying to install something. I have tried so many different configurations of... (5 Replies)
Discussion started by: a sandwhich
5 Replies

7. Shell Programming and Scripting

Expect - Comparison of expect value and loop selection

Hello All, I am trying to automate an installation process using expect and sh script. My problem is that during the installation process the expected value can change according to the situation. For Example if this is a first time installation then at step 3 I'll get "Do you want to accept... (0 Replies)
Discussion started by: alokrm
0 Replies

8. AIX

Advice - X11 not functioning

Hello Folks We have following software installed on our AIX box X11.vfb - Virtual Frame Buffer Software We also see its process running root 528406 1 0 06:27:18 - 0:00 /usr/bin/X11/X -force -vfb -x abx -x dbe -x GLX :1 Following is the o/p of 'lslpp' X11.vfb 5.3.0.50... (4 Replies)
Discussion started by: ak835
4 Replies

9. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

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

10. Shell Programming and Scripting

strange expect script behavior, or am i misunderstanding expect 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
Login or Register to Ask a Question