-1
我寫了一些難看的腳本,除了給我我想要的輸出外,還給了我狀態碼值。防止腳本輸出狀態代碼
腳本輸出如下。如何防止腳本在輸出中顯示狀態碼?
P.S.我把下面的腳本,希望它不會傷害你的眼睛太多
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
請格式化您的代碼(正確的代碼標籤,他們屬於,縮進,...)。 –
我們不知道哪個子組件打印了這個。嘗試爲所有'dsjob'調用添加'2>/dev/null',但要明白這也會使任何潛在有用的診斷變爲無效。 – tripleee