I want to do a function that will return the factorial of a number in bash
Here\'s the current code that doesn\'t work, can anyone tell me what\'s wrong and how to c
clear cat fact() { i=$1 if [ $i -eq 0 -o $i -eq 1 ] then echo 1 else f=`expr $i \- 1` f=$(fact $f) f=`expr $i \* $f` echo $f fi } read -p "Enter the number : " n if [ $n -lt 0 ] then echo "ERROR" else echo "THE FACTORIAL OF $n : $(fact $n) " fi