【问题标题】:Take the Output of curl and send to second curl command获取 curl 的输出并发送到第二个 curl 命令
【发布时间】:2012-11-12 01:26:31
【问题描述】:
curl -s http://meet97263421.adobeconnect.com/api/xml?action=common-info | \
grep -oP '(?<=<cookie>).*?(?=</cookie>)|(?<=account-id=").*?(?=")' 2>&1\

上面的 curl/grep 命令返回如下数据:

na3breezswp8yf3s5fghdgn4
1013353222

如何将这两个输出发送到第二个 curl 命令:

curl "https://meet97263421.adobeconnect.com/api/xml?\
action=login&login=USERNAME&password=PASSWORD&account-id=[$1]&session=[$0]"

我使用[$1][$0] 作为占位符。

【问题讨论】:

    标签: shell variables curl grep


    【解决方案1】:

    也许这有帮助:

    #!/bin/bash
    
    OUT=$(curl -s http://meet97263421.adobeconnect.com/api/xml?action=common-info \
    | grep -oP '(?<=<cookie>).*?(?=</cookie>)|(?<=account-id=").*?(?=")')
    
    # echo $OUT && echo 
    
    Session=$(cut -f1 -d' ' <<< $OUT)
    AccountID=$(cut -f2 -d' ' <<< $OUT)
    
    curl "https://meet97263421.adobeconnect.com/api/xml?action=login&login=USERNAME&password=PASSWORD&account-id=$AccountID&session=$Session"
    
    # or 
    
    curl "https://meet97263421.adobeconnect.com/api/xml?action=login&login=USERNAME&password=PASSWORD&account-id=`cut -f2 -d' ' <<< $OUT`&session=`cut -f1 -d' ' <<< $OUT`"
    

    【讨论】:

      猜你喜欢
      • 2022-10-17
      • 2018-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-18
      • 2017-03-26
      相关资源
      最近更新 更多