使用 xargs 使用curl 时输出丢失

使用 xargs 使用curl 时输出丢失

单独使用curl作为

curl 'https://abc.ai/getMultiDashboard/' -H '用户代理:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0' -H '接受:application/ json' -H '接受语言:en-US,en;q=0.5' --compressed -H '连接:保持活动' -H '引用者:https://abc.ai/'-H 'Cookie:_ga=GA1.2.561275388.1601468723; _hjid=ecd3d778-b7f5-4f7f-b3ef-6f9f12b13d66; 54651cc_an=4; _gid=GA1.2.1366208807.1601560229; _hjTLDTest=1; 54651cc_data=JTdCJTIyaWQlMjIlM0ElMjJkZW1vdXNlciUyMiUyQyUyMm4lMjIlM0ElMjJkZWhY2Nlc3NUb2tlbiUyMiUzQSUyMjA2MTk3NjM3NTgwOGE2N2RmZjlhMmJlOWJmode5NDQzJ TIyJTdE; 54651cc_loggedin=1; 54651cc_sound=真; 54651cc_read=真; 54651cc_popup=真; 54651cc_disablelastseen=假; 54651cc_usertype=登录用户; _hjIncludedInPageviewSample=1; _hjAbsoluteSessionInProgress=0;铱=s%3A8ZGd7Mol31n_Y8OCLq39dHoo3_mIlRhZ.pFQWz5gG9McKsQLzOikcTB​​mmb2Wcrxo%2B9u9iPpqoyxw; pageUrl=/#/仪表板/18; _gat_gtag_UA_97985973_5=1'

输出

[{"dashboard_id": 18, "user_id": "demouser", "dashboard_name": "My_dashboard_1", "description": "测试说明一", "creation_date": "2020-09-21 10:13:00" ,“dashboard_config”:空}]

跑步与

xargs -I % -P 2 curl 'https://abc.ai/getMultiDashboard/' -H '用户代理:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0' -H '接受:application/json' -H '接受语言:en-US,en;q=0.5' --compressed -H '连接:保持活动' -H '引用者:https://abc.ai/'-H 'Cookie:_ga=GA1.2.561275388.1601468723; _hjid=ecd3d778-b7f5-4f7f-b3ef-6f9f12b13d66; 54651cc_an=4; _gid=GA1.2.1366208807.1601560229; _hjTLDTest=1; 54651cc_data=JTdCJTIyaWQlMjIlM0ElMjJkZW1vdXNlciUyMiUyQyUyMm4lMjIlM0ElMjJkZWhY2Nlc3NUb2tlbiUyMiUzQSUyMjA2MTk3NjM3NTgwOGE2N2RmZjlhMmJlOWJmode5NDQzJ TIyJTdE; 54651cc_loggedin=1; 54651cc_sound=真; 54651cc_read=真; 54651cc_popup=真; 54651cc_disablelastseen=假; 54651cc_usertype=登录用户; _hjIncludedInPageviewSample=1; _hjAbsoluteSessionInProgress=0;铱=s%3A8ZGd7Mol31n_Y8OCLq39dHoo3_mIlRhZ.pFQWz5gG9McKsQLzOikcTB​​mmb2Wcrxo%2B9u9iPpqoyxw; pageUrl=/#/仪表板/18; _gat_gtag_UA_97985973_5=1'
< <(printf '%s\n' {1..2})

输出 根@根:~#

基本上,我认为 xargs 我无法解析多行curl cmd,请帮助我排除故障

更新 使用完全相同的 cmd 逻辑,我得到不同的结果,它实际上输出 HTTP 响应 xargs -I % -P 2 curl -I "https://youtube.com" < <(printf '%s\n' {1..2})

HTTP/2 301
content-length: 0
strict-transport-security: max-age=31536000; includeSubDomains; preload
location: https://www.youtube.com/
date: Fri, 02 Oct 2020 18:04:05 GMT
content-type: text/html
server: YouTube Frontend Proxy
x-xss-protection: 0
alt-svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"

HTTP/2 301
content-length: 0
strict-transport-security: max-age=31536000; includeSubDomains; preload
location: https://www.youtube.com/
date: Fri, 02 Oct 2020 18:04:05 GMT
content-type: text/html
server: YouTube Frontend Proxy
x-xss-protection: 0
alt-svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"

相关内容