Today I am writting a libexpect program with expect which would login to a remote system and run some commands, them get the result back.
Here are two questions that always confusing me.
1.while I logon to remote system successfully, How can I decide whether the shell is ready or not so that I can run commands on it.
I tried match "# " with root and "$ " with non-root users, but if the result contains such string the program would think that shell is ready while it is not, so it will send next command…
2.man page says that while the content of output is so much that the expect buffer can not hold, it will cut the first half of expect buffer and copy the left half down so that it can hold more new generated characters.
If I want all the output information, what can I do? or if I could change the buffer size of expect ,which variable should I alter.
Any hlp would be appreciated!
For #1 when I face that problem I change the prompt to something unique after logging in.
For #2 in scripts the variable is match_max but I don't know if that is different for libexpect.
Thanks ender21014. It's so kind of you to tell me that.
I acutally find the answer for the second one , its exp_match_max variable:)