Using regular expression in expect script
using regular expression in expect scripts
i wrote expect script that will check string out put of "show clock" command but i want to validate this using regular expression...how i can do validation using expect script & store output from expect command. ================================== sample expect script #!/usr/bin/expect -f set timeout -1 spawn ./Nikcli.sh expect -exact "\rNik> [m" set date_var [exec date] send -- "show clock\r" expect -exact "$date_var\r \rNik> " send -- "" expect eof ============================= -Thanks in advance |
Use the -indices flag to the expect command, and the -re pattern type option. Then the expect_out variable will be set after a match is found, and sub-expressions in your RE will be available.
From the expect manual page: Quote:
|
All times are GMT -5. The time now is 03:29 PM. |