Admin-Ahead Community

Linux => General Linux => Topic started by: arunlalpr on December 18, 2018, 10:29:08 am

Title: esac in shell scripting
Post by: arunlalpr on December 18, 2018, 10:29:08 am
esac in shell scripting

Like fi for if. esac is the spell backward of "case".


===================

#!/bin/sh

FRUIT="kiwi"

case "$FRUIT" in
   "apple") echo "Apple pie is quite tasty."
   ;;
   "banana") echo "I like banana nut bread."
   ;;
   "kiwi") echo "New Zealand is famous for kiwi."
   ;;
esac


==========================

Happy scripting.