求助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