iT邦幫忙

0

執行Unix程式出現Undefine Variable

  • 分享至 

  • xImage

求助Unix高手 ,小弟執行一個程式 ,但是跑到最後出現Undefine variable ,無法出現POP window
因小弟無寫程式觀念 ,所以煩請高手幫忙除錯
##############################################################################################
#!/bin/csh
#Purpose : Search Fatal error and Indicate On-duty to Handle PROD carefully
##############################################################################################
set DATE=date '+%m/%d/%Y'
set MN=hostname | cut -c14-
set WS = uname -a | cut -c64-
if ( $WS == Ultra-5_10 ) then
set ID = cat /etc/hostname.hme0
else if ( $WS == Netra-240) then
set ID = cat /etc/hostname.bge0
endif
set WARNING_mark="cat /usr/asm/data.0000/.ER/WARNING_event_mark"
set Start_Line = grep -n "$WARNING_mark" /usr/asm/data.0000/.ER/ER_event_log | head -1 | nawk -F: '{print $1}'
##############################################################################################
rm -f /tmp/new_warning_record /tmp/fatal_warning_record /tmp/warning_code
if ( $Start_Line == "" ) then
set Start_Line = grep -n "$WARNING_mark" /usr/asm/data.0000/.ER/ER_event_log.old | head -1 | nawk -F: '{print $1}'
tail +$Start_Line /usr/asm/data.0000/.ER/ER_event_log.old > /tmp/Old_warning_record
cat /tmp/Old_warning_record /usr/asm/data.0000/.ER/ER_event_log > /tmp/new_warning_record
else
tail +$Start_Line /usr/asm/data.0000/.ER/ER_event_log > /tmp/new_warning_record
endif

nawk -f /usr/asm/data.0000/mc_tool/fatal_error.awk /tmp/new_warning_record > /tmp/fatal_warning_record
tail -50 /usr/asm/data.0000/.ER/ER_event_log | grep '../../.... ..:..:..' |tail -1| cut -c1-20 > /usr/asm/data.0000/.ER/WARNING_event_mark
##############################################################################################
if ( wc -l /tmp/fatal_warning_record | nawk '{print $1}' == 0 ) then
exit 0
else
grep "WARNING:" /tmp/fatal_warning_record | grep -v "linked to" | nawk '{print $3}'> /tmp/warning_code <---程式可以執行到這裡
foreach ERROR_CODE ( cat /tmp/warning_code )
if ( echo $ERROR_CODE | cut -c1-2 == "TS" ) then
/usr/local/bin/say -bs "Alarm! Call On Duty PE 8238: FATAL ERROR $REMA Shift, please Inform 8238 Check" &
endif
end
endif

weiclin iT邦高手 4 級 ‧ 2016-12-13 18:27:02 檢舉
所以 /tmp/warning_code 裡面有東西嗎? 還有 `$REMA` 哪來的?
9116zm iT邦新手 5 級 ‧ 2016-12-14 10:12:58 檢舉
/tmp/warning_code <--裡面有東西
感謝大大幫忙讓小弟發現問題 ,感恩阿!!!
$REMA <--- 改錯了
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答