I am writing a script to upload a file on server by using Curl.
while [ "$1" != "" ] ; do
case "$2" in
-upload)
curl -X POST -F 'file=@$2' -F '....' http://....
printf "\n"
;;
*)
echo 'unknown argument'
exit -1
;;
esac
shift
done
The thing is I don't know how to write $1 in the curl properly ('file=@$1') . When I use this script, it always announce error: curl: couldn't open file "$1"