Checking Whether a URL Exists from the Command Line
Run the following command from a terminal on your local Mac:
1 | curl -v <URL> 2>&1 1>/dev/null | awk '{if($2~"HTTP") print}' |
OK Pattern.
1 | < HTTP/1.1 200 OK |
NG Pattern
1 | < HTTP/1.1 404 Not Found |
Run the following command from a terminal on your local Mac:
1 | curl -v <URL> 2>&1 1>/dev/null | awk '{if($2~"HTTP") print}' |
1 | < HTTP/1.1 200 OK |
1 | < HTTP/1.1 404 Not Found |