Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 10-07-2003, 01:24 PM   #1
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 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 01:27 PM.
Old 10-07-2003, 03:34 PM   #2
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.


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

All times are GMT -5. The time now is 06:43 AM.

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