Reputation: 1891
I wonder if it is possible provide instead of file path file content itself. For example curl
needs to specify file path to certificate. What to do when I have a certificate in variable?
I can't put it into stdin, because I'm generating xml to send there.
Why I put certificate into variable? Because at the end I'd like to have just one file with script, which can I easily distribute to my colleagues.
The only solution which come to my mind is to save variable to file and then provide file path to curl
read -d '' CERT << "CERTEND"
-----BEGIN CERTIFICATE-----
### something very secret here ###
-----END CERTIFICATE-----
CERTEND
curl -# -k --cert ??? -d @xml.xml -H "Content-Type: application/soap+xml" -H 'SOAPAction: ""' https://1.1.1.1/EndpointPort`
Upvotes: 1
Views: 465
Reputation: 35950
You can use process substitution:
curl --cert <(echo "$CERT") ...
which would create a pipe for you. The output of the command in parentheses goes to this pipe (echo $CERT
in our case), and the filename of the pipe is returned.
Upvotes: 1