zoukankan      html  css  js  c++  java
  • shell中curl命令变量替换

    变量替换脚本写法如下,msg变量调用使用:"'"变量"'"

    # cat msg.sh 
    #!/bin/bash
    msg="测试脚本"
    curl -i -X POST -H "'Content-type':'application/json'" -d '{"msgtype":"text","text":{"content":"'"${msg}"'","mentioned_list":["@all"]}}' https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=自己的key
    
    # sh msg.sh 
    HTTP/1.1 200 OK
    Server: nginx
    Date: Fri, 10 Dec 2021 05:58:45 GMT
    Content-Type: application/json; charset=UTF-8
    Content-Length: 27
    Connection: keep-alive
    Error-Code: 0
    Error-Msg: ok
    
    {"errcode":0,"errmsg":"ok"}

    企业微信发送内容:

  • 相关阅读:
    re模块
    collections模块
    hashlib模块
    序列号模块
    random模块
    sys模块
    OS模块
    工厂模式
    Go语言之直接选择排序
    Go语言之直接插入排序
  • 原文地址:https://www.cnblogs.com/cyleon/p/15671478.html
Copyright © 2011-2022 走看看