Here is one example::
Code:
month_to_num() {
if [ -n "$1" ]
then
t_month=$1
case $t_month in
Jan) return 01;;
Feb) return 02;;
Mar) return 03;;
Apr) return 04;;
May) return 05;;
Jun) return 06;;
Jul) return 07;;
Aug) return 08;;
Sep) return 09;;
Oct) return 10;;
Nov) return 11;;
Dec) return 12;;
*) return 0;;
esac
fi
}
To call a function and store result in a variable see below lines
Code:
month_to_num $time_month
v_month_index=$?
if you call this function with parameter jan,feb,mar....you will store their index value in variable v_month_index.