0

Not able to get my head around the below function. Please somebody explain in simple way?

Stat() {
if [ "$1" = "SKIP" ]; then 
    echo -e " > $2 - \e[35mSKIPPING\e[0m"
elif [ $1 -eq 0 ]; then 
    echo -e " > $2 - \e[32mSUCCESS\e[0m"
else
    echo -e " > $2 - \e[33mFAILURE\e[0m"
    echo Refer $LOG file for errors
    exit 1
fi 
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
stalin
  • 369
  • 2
  • 5
  • Maybe this can help: https://stackoverflow.com/questions/29258603/what-do-0-1-2-mean-in-shell-script – dWinder Sep 23 '18 at 09:53
  • Depends what are you not understanding. The function receive 2 arguments, if the first is 0 print's success, if it's SKIP it prints skipping, if it's anything else it prints Failure. That's about it. – Andre Gelinas Sep 23 '18 at 14:12

0 Answers0