So, I have this if/else condition which checks for a certain string in curl output. If the output has either "yahoo" or "google", then I want it to hit the if block, otherwise hit the else block. I used -q to search for yahoo. But I am not sure how to add two conditions [that is one string as "yahoo" and the other string as "google" in the same curl query]
if curl https://yahoo.com | grep -q "via yahoo"
echo "via yahoo or hotmail"
else
echo "not via yahoo or gmail"
fi
curl
2 domains at once orgrep
for either of 2 strings in the output of acurl
command or identify which of multiplecurl domain
commands produced output or something else. Please edit your question to clarify what it is you're trying to do.curl https://yahoo.com
I just get the outputredirect
and when I runcurl https://google.com
I get output includingThe document has moved
, neither of which outputsvia ...
so I'm thinking you don't really want to parse the curl output in the way you show. Please provide sample input and expected output that would clarify your needs and we can copy/paste test with.