Currently, I'm checking a site with curl
and grep
for a particular pattern.
for i in {1..300}; do
curl -s http://example.com | grep "Welcome to "
status=$?
# if status is 0 - print found else not found
sleep 1;
done
How to convert this shell code into JavaScript code? I would like to print something like this:
//cURL req & get status of grep
if ( status == 0 )
alert("Its found");
else
alert("Not found Yet");
Thanks for any help or JSFiddle references. :)
EDIT: I came across this http://jsfiddle.net/GSSCD/203/ and this get sourcecode after javascript execution with curl I'm hoping for something like that based on JavaScript.
EDIT 2: Running on browser, need to verify this from browser. Platform already uses jQuery (Flask-based server).