【问题标题】:wget how to send HTTP response to STD OUT or File when using post-filewget如何在使用post-file时将HTTP响应发送到STD OUT或File
【发布时间】:2014-10-20 08:53:09
【问题描述】:

我一直在寻找几个小时,但我找不到解决方案。

我使用 wget 以这种方式将文件上传(HTTP PUT)到服务器:

/usr/bin/wget '--header=Content-Type: application/xml' '--post-file=/tmp/cda_initialParentApplication.xml' 'https://myserver.net:8443/remote/rest/v1/application?force=true' '--no-check-certificate' '--server-response' '--output-file=/wget_put.txt'

一般来说它工作正常。唯一的事情是,一旦上传完成,就会创建一个包含响应的新文件:

... ... Saving to: ?application?force=true? 0K 100% 8.81M=0s

$more application\?force\=true <?xml version="1.0" encoding="UTF-8" standalone="yes"?><results><result updated="true" targetName="myApp"/></results>

有没有办法避免在该文件中创建此响应消息?理想情况下将该响应发送到 STD OUT 或特定文件??

谢谢!

【问题讨论】:

    标签: http wget put


    【解决方案1】:

    你可以像这样重定向输出做 /dev/null (并启用安静):

    wget --quiet -O /dev/null http://...
    

    【讨论】:

    • 您好,感谢您的意见。是的,我同意,最好的方法是将输出重定向到其他地方,例如 /dev/null。
    猜你喜欢
    • 1970-01-01
    • 2015-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-24
    相关资源
    最近更新 更多