Reputation: 913
I am having an issue with the entering the following command in bash at the moment:
RESPONSE=`curl -k "$line" --cert=\"$certfile:$certpassfile\" --silent --write-out --head '%{http_code}\n'`
where $line
is the url, $certfile
is the path to the pem file, $certpassfile
is the certificate password.
I am getting the following error:
++ curl -k url '--cert="/certpath:certpassword"' --silent --write-out --head '%{http_code}\n'
curl: option --cert="/certpath:certpassword": is unknown
When i don't double the quotation marks around the certificate file and don't escape it, so the command looks like the below:
RESPONSE=`curl -k "$line" --cert="$certfile:$certpassfile" --silent --write-out --head '%{http_code}\n'`
I receive the same error but a different path:
++ curl -k url --cert=/certpath:certpassword --silent --write-out --head '%{http_code}\n' curl: option --cert=/certpath:certpassword: is unknown
Any idea how I can create the command at it should be which is:
curl -k url --cert="/certpath:certpassword" --silent --write-out --head '%{http_code}\n'
Upvotes: 0
Views: 212
Reputation: 59486
I think you just should strip that equal sign between --cert
and the value:
RESPONSE=$(curl -k "$line" --cert "$certfile:$certpassfile" \
--silent --write-out --head '%{http_code}\n')
Upvotes: 2