LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-31-2012, 04:07 AM   #1
yadvinder
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
G=1


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


Reply


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
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
Issue in running shell script using cron job in Unix server. Mundlamuri Programming 7 07-12-2011 11:37 AM
running shell script within expect script xombboxer Linux - Newbie 2 05-01-2011 12:42 PM
Problem running an Expect script within a Bash script mbeipi Programming 8 03-15-2011 04:07 PM


All times are GMT -5. The time now is 06:27 PM.

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