In shell scripting how to find factorial of a number?
Here is a recursive function in Bash:
factorial () { if (($1 == 1)) then echo 1 return else echo $(( $( factorial $(($1 - 1)) ) * $1 )) fi }
Of course it's quite slow and limited.