Amir Rachman Amir Rachman - 11 months ago 75
Bash Question

grep on lynx command

I want to grep the result on lynx command

lynx -head -dump

Result for that command

Looking up
Making HTTP connection to
Alert!: Unable to connect to remote host.

lynx: Can't access startfile

I want that word replace to be 0 or down, I try to create bash script, but that command still shown. Result that i want is.

#lynx -head -dump

Already try to use if else on the bash but still doesn't work.

Answer Source

How about using the exit code to determine if the site is up?

For example:

$ lynx -head -dump 2> /dev/null || echo Down