We have a command-line interface to logon to a system like so:
$ cli -u username -p password
In case if the wrong password is provided the message we get is " Credentials incorrect" and then it waits for the right password to be entered and doesn't quit. If the right password is provided, it doesn't provide any message and logs on directly.
I am looking to terminate the command in case the password is wrong, rather than waiting for the user input.
The idea is to look for the keyword Credentials and if it is found then kill the command:
$ cli -u username -p password | grep Credentials
How would I do that?