0

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'

1 Answer 1

2

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')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.