How to run a shell command in an expect script and check for some specific string?
#!/usr/bin/expect
set timeout 20
send "ps -aef | grep P1"
expect "string"
Blah
Blah
exit;
I tried with spawn, exec and system command in place of send, but it always timed out or ended in some error.