LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 02-08-2004, 10:01 PM   #1
neyoung
LQ Newbie
 
Registered: Feb 2004
Posts: 17

Rep: Reputation: 0
help with expect


ok, I have been using autoexpect to generate expect scripts. What I am trying to do is login into a remote machine using ssh and execute another script and then logout. My first question is...

Is expect the best thing to use for this?

The script that autoexpect generates logs into the machine fine. But, the script that I want to execute does not execute. I think that the problem is, is that the computer that I am trying to login to displays the last time that I loged in, and the date that I loged in. So the expect script is not recieving what it is expecting, because the last login time is always changing. Is there a way to ignore this and just wait a few seconds before doing anything else?

Thanks in advance for the response. If anything is unclear, I can try to clear it up for you.
 
Old 02-08-2004, 11:45 PM   #2
schmack
LQ Newbie
 
Registered: Feb 2004
Posts: 12

Rep: Reputation: 0
How about:

ssh user@remotemachine "cmd arg1 arg2"
 
Old 02-09-2004, 09:34 PM   #3
neyoung
LQ Newbie
 
Registered: Feb 2004
Posts: 17

Original Poster
Rep: Reputation: 0
alright, thanks. I don't know how I didn't try that, but it works Now I just have to figure out how to give arguments to an expect script, so it can do different things depending on what I send it.
 
Old 02-09-2004, 09:41 PM   #4
neyoung
LQ Newbie
 
Registered: Feb 2004
Posts: 17

Original Poster
Rep: Reputation: 0
well I found that arguments are passed using $argv. But I can't seem to get this line to work correctly...

spawn ssh user@server {~/stuff/script $argv}

it is recognizing $argv as "$argv" and not as the argument that is being passed in Is there anyway around this?
 
  


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 coolest Programming 7 02-16-2009 03:59 PM
Expect how to? e-freak Programming 2 09-24-2005 04:49 AM
How to use expect TomCruise2002 Linux - General 0 10-02-2003 09:53 PM
Using Expect for Linux rkeng Linux - General 2 08-01-2003 09:01 PM
expect sk8guitar Programming 3 07-29-2003 09:24 PM


All times are GMT -5. The time now is 12:36 AM.

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