我写了一些丑陋的脚本,除了在输出中给我想要的东西之外,它还给了我状态码值。
脚本输出如下。如何防止脚本在输出中显示该状态代码?
PS我会把脚本放在下面,希望不会太伤你的眼睛
Status code = 0
Status code = 0
Status code = 0
job_1_1_1
Status code = 0
Status code = 0
Status code = 0
Status code = 0
Status code = 0
Status code = 0
job_1_1_2
Status code = 0
Status code = 0
START_ID=`dsjob -logsum -type STARTED UPSTREAM_MDM_D4 seq_1_1 | nawk 'ORS=(FNR%2)?FS:RS' | grep Starting | tail -1 | awk '{print $1 }'`; FATAL_IDS=`dsjob -logsum -type INFO UPSTREAM_MDM_D4 seq_1_1 | grep INFO | awk '{print $1 }'`; for TEST_ID in ${FATAL_IDS}; do if [[ "${TEST_ID}" -ge "${START_ID}" ]]; then WARN_DTL=`dsjob -logdetail UPSTREAM_MDM_D4 seq_1_1 ${TEST_ID}`; if `echo $WARN_DTL|grep -q 'has finished, status = 3'`; then message=`echo $WARN_DTL| grep -oP '\w+(?= has finished, status = 3)'`; fatal_errors=$fatal_errors$'\n'$message;fi; fi;done; echo $fatal_errors