LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-07-2003, 02:24 PM   #1
wedgeworth
Member
 
Registered: Aug 2003
Posts: 234

Rep: Reputation: 30
problems with scripting in expect


i'm having problems capturing the output from a spawned command. the command is spawned and returns a filesize. the filesize is returned when i use interact in the script. is there anyway i can assign that return to a variable. or since i'm using interact, is the value stored in interact_out? any help would be appreicated....or if anyone who could point me to a site or board that has help for expect scripters. below is my script thus far.



spawn ssh backup@www.bob.com du -sk /Volumes/extdrive1/serverBackups/backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "

expect -re "password:"
send "****\r"

interact -re

set SIZE2 $interact_out(spawn_id) #ERROR HERE


p.s. i also wonder if there was a way to have all output redirected to a file.....having problems getting that working too.

Last edited by wedgeworth; 10-07-2003 at 02:27 PM.
 
Old 10-07-2003, 04:34 PM   #2
wedgeworth
Member
 
Registered: Aug 2003
Posts: 234

Original Poster
Rep: Reputation: 30
i'm also having problems with the set command. the command

du -sk backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "

works fine when spawned. and

du -sk backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z

works from the command line. but i'm having problems using it in a set command.

set SIZE [exec du -sk backup.$HOSTNAME.$DATE.tar]

works fine. but

set SIZE [exec du -sk backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "]


doesn't work fine. any help with this would be appreicated. if it doesn't make sense...just say something and i'll try to be plainer.
 
  


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 scripting] send problem ldp Programming 1 01-24-2005 03:39 PM
expect scripting Deltron3030 Linux - Newbie 2 12-16-2003 02:56 PM
expect scripting syntax problems...(catch, echo,....) wedgeworth Linux - Software 2 10-02-2003 10:24 AM
still problems with expect wedgeworth Linux - Software 2 09-15-2003 03:06 PM
scripting problems.. imnna2 Linux - Newbie 2 04-02-2001 10:44 AM


All times are GMT -5. The time now is 09:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration