I am trying to do a conditional check of the result of two grep commands in a bash script, but I cannot seem to combine them like:
if [[ $( stout_cmd1 | grep -q 'check_txt1' ) || ( $( stdout_cmd2 | grep -q 'check_txt2' ) ]] ; then
//do something here if output of stdout_cmdX contains text check_txtX
fi
as it always returns false. Conditionally checking the commands on their own work as intended:
if stdout_cmd1 | grep -q 'check_txt1' ; then
or
if stdout_cmd2 | grep -q 'check_txt2' ; then
, but I don't know how to check if either one is true. How does one combine two stdout outputs in a conditional check? I have removed the -q flag from the grep calls with no effect.
Aucun commentaire:
Enregistrer un commentaire