shell - curl call with parameters into variable doesn't work -
i'm working installr api. i'm trying following curl request via script :
curl -h "x-installrapptoken: mytoken" https://www.installrapp.com/apps.json/ \ -f 'qqfile=@'$apkpath \ -f 'releasenotes=these release notes' \ -f 'notify=true'
and works perfectly. however, when try release notes file variable :
releasenotes=`cat "release_notes/test.md"` curl -h "x-installrapptoken: mytoken" https://www.installrapp.com/apps.json/ \ -f 'qqfile=@'$apkpath \ -f 'releasenotes='$releasenotes \ -f 'notify=true' > /dev/null
it doesn't work @ all, first word sent. others, have error not resolve host: xxx.
i did echo
on these 2 curl request , exact same thing printed. cat
command return specific format ?
probably issue quotes , spaces. can use double-quotes around variable allow variable expansion in shell.
releasenotes=$(cat "release_notes/test.md") curl -h "x-installrapptoken: mytoken" https://www.installrapp.com/apps.json/ \ -f "qqfile=@${apkpath}" \ -f "releasenotes=${releasenotes}" \ -f 'notify=true' > /dev/null
Comments
Post a Comment