I'm using an expect script to connect to a windows machine and execute an ant script. After completion I want to delete a file and log out. The execution of the ant script takes almost 30 seconds, so I added a "sleep 40" to the expect script. But what if the execution time will be much longer? Is there a way to let the expect script wait without using the sleep command?
Yes, ofcourse you can, why don't you see what is outputed to the screen after the script has finished ? For example:
where ssh:/C/remoteWindows/myfolderwithantscript/ is the text you get after the scipt finishes, on a linux machine is something like this: /home/alex/Documents$ for example, and then you send the 'rm' command to remove the file.
This is what I do so as to upload a file to an ftp server. I just do a
and then proceed to the next steps.