I am trying to create a script that will run wget to a few sites and check if we receive a 200 OK from the site.
My problem is that the result of wget application is shown in the stdout. Is there a way I can hide this.
My current script is:
RESULT=`wget -O wget.tmp http://mysite.com 2>&1`
Later I will use regex to look for the 200 OK we receive from the errout that wget produces.
When I run the script, it works fine, but I get the result of the wget added between my echos.
Any way around this?
You can use:
And this does the trick too:
Played around a little and came up with that one:
This outputs nothing but “200” – Nothing else.