I am writing a PERL-Expect script to automate testing. In the script I want to get the warning messages when a command is executed and take action based on the warning messages. The warning messages can differ based on some situations and also the warning may not be shown at all.
prompt>delete fs
WARNING: Are you sure?(Y/N).. backup is running:
In the above scenario I need to get the WARNING message as input before proceeding and then do some processing before sending a reply.
The warning may not be displayed as shown below in some cases, for e.g., if backup is not running and command be executed without processing them:
prompt>delete fs
Done.
prompt>show fs
...
How to get the warning message after the command is send if it is displayed?
Thanks.