LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 09-03-2003, 08:23 PM   #1
cdwells
LQ Newbie
 
Registered: Sep 2003
Posts: 1

Rep: Reputation: 0
Simple Expect problem.. please help :)


Hey folks,

I'm somewhat familir with Expect, however I've come to a point where I need to write a script to log into a remote machine, execute a command (that being a shell script on the remote machine) and assign the output of that command to a variable and possibly an array if more than one.

My script intends to log into the machine and run a script to determine whether the "informix" userid exists. The shell script on the remote box (isinformixhere.sh) works perfectly.

Here's the segment of my Expect script which I'm having problems with:

set informix [exec $scriptdir/isinformixhere.sh]

The problem is, of course, the exec command runs the command on the LOCAL machine. and not the remote machine. Is there a way to execute a remote command in this fashion.

Any help or suggestions would ge GREATLY appreciated! Thanks!
 
Old 09-04-2003, 01:09 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Welcome to LQ.

If you use ssh you can use password less logins and you wouldn't even need to use expect. eg:
ssh somuer@somehost isinformixhere.sh

You could run this from a bash or perl script then capture the output to a variable.
 
Old 07-30-2008, 02:49 AM   #3
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Rep: Reputation: 17
In expect, how to capture the output into variable..lets say, when we do ls -1rt, how to capture the output into array, so that i can access individually.

Thanks
 
  


Reply



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 scripting] send problem ldp Programming 1 01-24-2005 02:39 PM
CGI script problem: Send/Expect command echo on webpage rajatgarg Programming 2 07-11-2004 04:38 PM
Expect: trivial problem with passwd mallouk Programming 2 05-19-2004 07:21 AM
help with expect neyoung Programming 3 02-09-2004 09:41 PM
Weird ISP problem: expect (#) weppnesp Linux - Newbie 0 10-06-2002 12:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:38 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration