Thursday, February 8, 2007

Writing Case - Shell Begineer


This is for them, who are very new to Shell Prog, just an example to see the use of case, hope this helps :-)

#!/bin/sh
#To find the day

day=`date| awk '{print $1}'`

modify()
{
case $1 in
Sun) echo "Sunday";;
Mon) echo "Monday";;
Tue) echo "Tuesday";;
Wed) echo "Wednessday";;
Thu) echo "Thursday";;
Fri) echo "Friday";;
Sat) echo "Saturday";;
*) echo "Not Estimated";;
esac
}

echo "Today is "`modify $day

No comments:

© Jadu Saikia www.UNIXCL.com