if you escape the [ ... wouldn't you need to escape the ] ?
On 9/20/05, Greg Brown <[EMAIL PROTECTED]> wrote: > Ah! In case anyone else runs into this, it turns out the probelm was the > following line: > > expect "*[y/n]:" > > I should have seen this the first time, but the problem is the "[" > character. This is a character that is used in if/then loops (i.e. if ![ 1 = > 2 ] - and I'm not sure if that sytax is correct). Anyway, the fix was to put > the standard escape character "\" before the "[" and the problem goes away. > With that in mind the new line is: > > expect "*\[y/n]:" > > Volia. Problem solved. > > Greg > > On 9/20/05, Greg Brown <[EMAIL PROTECTED]> wrote: > > > > Hey peeps.. I seem to have a bug in my expect script. The script changes > > passwords on HP blade servers via telnet. It appears that I am getting an > > extra line back from the server that I was not, um, expecting and it causes > > the script to exit. Here is the section of script I am concered with: > > > > # look for "accepted" > > expect "*accepted." > > > > # now look for <hostname>-User Access Control# > > expect "*Control#" > > > > # send an apply > > send "apply\r" > > > > # look for the same prompt as before > > expect "*Control#" > > > > # now tell it to save > > send "save\r" > > > > # now look for the FLASH prompt > > expect "*[y/n]:" > > > > # enter a "Y" > > send "Y\r" > > > > the script fails after "apply" here is captured output (but redirecting > > stdout, nothing was ever sent to stderr): > > > > - User Access Control# usrpw > > Changing USER password; validation required: > > Enter current administrator password: > > Enter new user password: > > Re-enter new user password: > > New user password accepted. > > > > >> rtpndsfnth1a8 - User Access Control# apply > > ------------------------------------------------------------------ > > Apply complete; don't forget to "save" updated configuration. > > > > >> xxxxxxxxxxx - User Access Control# spawn telnet xxx.xxx.xxx.252 > > Trying xxx.xxx.xxx..252... > > > > > > See, that extra "Apply complete" line seem to be throwing me off. The next > > line should be the "Control" prompt I am looking for and I thought that this > > extra line would be processed as I thought it should but it is causing the > > whole script to fail. The script itself is called via a shell script and it > > is only invoked one IP at a time (via the parent shell script). > > > > Any ideas? > > > > Greg > > > > > -- > TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug > TriLUG Organizational FAQ : http://trilug.org/faq/ > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ > TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc > -- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
