I am using cURL to GET a page from a website that uses Basic auth. Let say the command line with the credentials looks like this (notice the two dollar signs in "pa$$word"):
curl -u "username:pa$$word" https://example.com
When I stick this command inside a Makefile, I get HTTP/1.1 401 Unauthorised
.
The problem is cleary the two dollar signs in combination with the Makefile, because:
curl -u "username" https://example.com
works (provided I type "pa$$word" at the prompt).
And this works in Bash (not inside a Makefile):
curl -u 'username:pa$$word' https://example.com
I've tried various tricks to escape those dollar signs. So far, I've tried (without success):
curl -u "username:pa\$\$word" https://example.com
curl -u "username:pa$$$$word" https://example.com
curl -u "username:{pa$$word}" https://example.com
curl ---netrc https://example.com # Credentials are in .netrc
For those downvoters concerned about me putting a password in plain text inside a Makefile - the password in question is for a public test server where the company has disclosed all the credentials required to paricipate in the test on a public webpage.
I basically try to script my test procedure using a Makefile, rather than using ssh to type the same commands over and over again.
Note: Some has suggested that this is a duplicate of a more general question about Escaping in makefile. However, my question is specifically about how to escape 2 dollar signs inside a Makefile. It is not obvious (at least not to me) how the general case answer applies to this use case.