shell script for curl command with variable in --data-binary

Viewed 24

for day now i am trying to get this shell script line of code done that should just have a parameter with a variable. I have tried:

file=~/myname-"`date +"%Y-%m-%d"`".abc
file_at=`(printf '"@';printf ${file};printf '"')`
curl -H "Content-Type: application/timestamp-query" --data-binary $file_at https://someserver.com --output myname-"`date +"%Y-%m-%d"`".def

The response is wrong which can be verified by another call and changing the $file_at to a filename '@filename.def' will yield a correct verification.

So the question is just, how can the --data-binary argument be a variable? I have tried everything I could find on SO but without any success. Alternatively a python script with requests or httpx would be fine.

Kind regards

0 Answers
Related