Reputation: 53
eg. I can execute below command in terminal successfully:
curl -sX POST -F 'file=@/tmp/test.tgz' -F 'fileName=test.tgz' http://localhost:8080/upload
However, if I replace the file path str "/tmp/test.tgz" with a variable in a bash shell script, then it wouldn't work, could you please help to tell me how to resolve it?
curl -sX POST -F 'file=@$myfile' -F 'fileName=test.tgz' http://localhost:8080/upload
Upvotes: 0
Views: 2263
Reputation: 1
ff="'file=$myfile'"
fname="'fileName=test.tgz'"
eval curl -sX POST -F $ff $fname http://localhost:8080/upload
Upvotes: 0