ok i've learned that the problem isn't with the above code (the exec command works fine). problem is with interact control that is in the script above before the mail command. (i'm using interact therefore the script works fine from the command line ). the problem is i have the interact command in the scirpt bookended by log-file commands to retrieve the filesize that is being outputted by the ssh command. if anyone knows how to have the interact command that retrieves the output from ssh and still is able to have the exec work correctly afterwards (stop the scirpt from "interacting") then i would appreciate any help:
#get SIZE
spawn du -sk backup.$HOSTNAME.$DATE.tar
#set SIZE [exec du -sk backup.$HOSTNAME.$DATE.tar]
log_file -noappend file
interact
log_file
set SIZE [read $file1 7]
#set SIZE 10
#get SIZE2
spawn ssh backup@
www.bob.com du -sk /Volumes/extdrive1/serverBackups/backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "
expect -re "backup@
www.bob.com's password:"
send "******\r"
log_file -noappend typescript
interact -re
log_file
set junk [read $file 1]
set SIZE2 [read $file 100000]
#printout
send_user "SIZE is $SIZE\n"
send_user "SIZE2 is $SIZE2\n"
#check difference
if {$SIZE != $SIZE2} {
.
.
.
.
code from here on is seen above. if you take the interact commands out then the "exec mail....." commands work fine. the interact is messing things up. i need to kil the spawned process and don't know how to yet.