I cannot seem to exit a bash script if
op signin company_name is unsuccessful, such as an incorrect password. The script has a couple processes that I'd only like to complete if the signin is successful. Otherwise, I'd like the script to exit.
I've tried to capture the output of the
op signin command, but it is always empty. The output is super predictable, since it always starts with
[LOG], which is great! But I can't store it in a variable for a conditional exit.
Here's an example of what I'd like to accomplish:
#!/bin/bash op signin company_name if [[ $? = *LOG* ]]; then echo "Error: Incorrect password" exit fi # rest of script
Any ideas or best practices? Ideally the user should be able to just fire off the script, type in their password, and either exit or continue based on that result.
1Password CLI version = 0.5.5
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: macOS 10.14.3
Sync Type: Not Provided