Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-31-2012, 05:07 AM   #1
LQ Newbie
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Unhappy Issue in running commands in expect script from shell script

Hi All,

I have the problem to run the commands in expect script from shell script.
Mentioned below is the expect script.

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

#set -x

set NODENAME [lindex $argv 0]

set NAME [lindex $argv 1]

set timeout 50

spawn eaw "$NODENAME\r"

expect "<"

sleep 01

send "xxx:xxx=xxx,xxx=$NAME;\r"
## here it automatically gets the name.
expect "<"

sleep 00

send "exit;\r"

Here i want to run some commands.
I am able to login using node name(which is basically the BSC Node).Also
my first command is working fine.

Input of nodename and cellname i am getting from shell script and is automatically taking that.

But for me the next challenge is to run the next commands ..

In expect script we have
send "xxx:xxx=xxx,xxx=$NAME;\r"
## here it automatically gets the name

and this command will display the output like

Mentioned output is

so my next command should take these values of G1 which is 1
First it should fetch that selected value "1" and then run the
next command and put that value 1 in the gap .

<xxx:xx=xxx- ; ## By defining "1" in the space command should run

then it further run the next command and finally exit.

How can i do that. How should i define the variables for the next commands also?

..I am totally stuck..

Somebody help me in this ASAP....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem running an Expect script within a Bash script mbeipi Programming 9 02-10-2018 06:00 AM
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 10:06 PM
Issue in running shell script using cron job in Unix server. Mundlamuri Programming 7 07-12-2011 12:37 PM
running shell script within expect script xombboxer Linux - Newbie 2 05-01-2011 01:42 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration