The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 10-10-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361

Code:
case ${STATE_XCFA[1]} in
     UP) clr=32 ;;
     DOWN) clr=31 ;;
     *) clr=0;
esac
printf "STATUS: \e[${clr}m%s\e[0m | STATE: \e[${clr}m%s\e[0m | NODE: \e[${clr}m%s\e[0m|\n" \
       "${STATE_XCFA[1]}" "${STATE_XCFA[2]}" "${STATE_XCFA[4]}"