Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
I don't think anyone will be able to answer you with that little information. How about showing the current script? –  geirha May 25 '12 at 16:22
add comment

1 Answer

Yes, ofcourse you can, why don't you see what is outputed to the screen after the script has finished ? For example:

expect "ssh:/C/remoteWindows/myfolderwithantscript/$"
send "rm a_file.txt"

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

expect "sftp>"

and then proceed to the next steps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.