sh 卷曲并捕获stdout和http状态

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 卷曲并捕获stdout和http状态相关的知识,希望对你有一定的参考价值。

#creates a new file descriptor 3 that redirects to 1 (STDOUT)
exec 3>&1 
# Run curl in a separate command, capturing output of -w "%{http_code}" into HTTP_STATUS
# and sending the content to this command's STDOUT with -o >(cat >&3)
HTTP_STATUS=$(curl -w "%{http_code}" -o >(cat >&3) 'http://example.com')

以上是关于sh 卷曲并捕获stdout和http状态的主要内容,如果未能解决你的问题,请参考以下文章