I was given a list of urls that are generating 404 errors as reported to us by google.
I can test a url with curl (from the command line ) like this:
curl -k --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" https://MYURLHERE
which works exactly as I expected. I wanted to put this in a script so I can run through a list of them
here is what I have.
#!/usr/bin/bash
url=$1
curlcmd="curl -k --user-agent \"Googlebot/2.1 (+http://www.google.com/bot.html)\""
$curlcmd $url
but its not working. I keep getting
curl: (1) Protocol "(+http" not supported or disabled in libcurl
I'm not sure how to escape this to make it work. any suggestions ?
Best Answer
put quotes around your variable $1, or you can use something like this: