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. |
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. |
All times are GMT -5. The time now is 09:07 AM. |