2012-11-12 171 views
0
curl -s http://meet97263421.adobeconnect.com/api/xml?action=common-info | \ 
grep -oP '(?<=<cookie>).*?(?=</cookie>)|(?<=account-id=").*?(?=")' 2>&1\ 

上述捲曲/ grep命令返回以下數據:以捲曲的輸出並傳送到第二捲曲命令

na3breezswp8yf3s5fghdgn4 
1013353222 

如何這兩個輸出發送到一個第二捲曲命令:

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

我使用[$1][$0]作爲佔位符。

回答

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`" 
+0

這工作!謝謝! –

+0

@DavidNeudorfer不客氣! – felipsmartins