Shell executes the variables in the post data by Curl

Source: Internet
Author: User

Base_url= "Http://localhost:8199/fund/repayment/active"

4 context= "Content-type:application/json"

5 for line in ' cat $ '

6 do

7 Sleep 1

8 fstr=${line%,*}

9

Ten echo $fStr

sstr=${line#*,}

Echo $sStr

13

Http_code= ' curl-l-H $CONTEXT-x post-d ' {"appId": "'" $fStr "'", "userId": "'" $sStr "'", "Amount": "0.0", "Repaytype" : "0", "repaystatus": "1"} ' ${base_url} '

Echo $HTTP _code

Done


In JSON, the curly braces are measured in parentheses, which need to be "" amplified and then amplified with a ", so that the variables can be passed into the JSON data.


Shell executes the variables in the post data by Curl

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.