I'm creating a script that does a curl request to a predefined site. Unfortunately the script find the 3 parameters but the curl doesn't work properly.
Where is the problem? Here is my attempt.
random="$(cat something.txt)"
echo "ID: ${random} - File: $1 - Var: $2 - Cookie: $3"
url="$(curl -i -L -X POST --cookie 'info=$3' \
-F 'var=$2' \
-F 'submit=Send' \
-F 'file[]=@$1' \
https://example.com/upload?id=${random})"
The second line with echo
print out the correct values and the same POST request does not give any problem using directly the parameters but the curl
fails and gives me the following errors:
Warning: setting file /my/path/to.file
Warning: failed!