Multiline curl command

£可爱£侵袭症+ 提交于 2019-12-01 02:24:53

Use the \ escape character for multiline inputs

curl "http://WEBSITE" -H "Host: WEBSITE"\
-H "Accept: text/html,application/xhtml+xml\
,application/xml;q=0.9,*/*;q=0.8" 
h. samm

NOTE: watch out for the tendency to indent on multiple line commands, as it will embed spaces and screw up the curl command. the sed command replaces embedded spaces within the variables with the %20 string so that spaces can be used embedded in the strings you pass as variables

messageout="The rain in Spain stays mainly in the plains"
summaryout="This is a test record"
alertnameout="Test Alert"


curl -v -silent request POST "URL.com?\
summary=`echo $summaryout | sed -e 's/ /%20/g'`&\
alertname=`echo $alertnameout | sed -e 's/ /%20/g'`&\
message=`echo $messageout | sed -e 's/ /%20/g'`"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!