To achieve this, you can use the following shell script:

#!/bin/bash

curl_command="curl <your_curl_arguments>"

if ! $curl_command; then
    echo "Artifact upload failed"
fi

Replace <your_curl_arguments> with the actual arguments you want to pass to the curl command. If the curl command fails, it will return a non-zero exit code, causing the if condition to be true and the error message "Artifact upload failed" will be printed.

shell 实现curl 命令失败后日志打印:制品上传失败日志打印使用英文表示

原文地址: https://www.cveoy.top/t/topic/ibz2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录