#!/usr/bin/env bash 
#Recursive factorial function

factorial() {
    echo "We are inside a factorial function"
}

# Main script
read -p "Enter the number:" n
if [ $n -eq 1 ];
then
    echo "factorial value of 0 is 1"
else
    # Calling factorial function
    factorial $n
fi


Type below code snippet inside a 'factorial' function replacing the
echo statement.

Replace 'echo "We are inside a factorial function"' statement with the
following code.

--------------------------------------------------

    temp=$1
    if [ $temp -eq 1 ]; then
	echo "1"
    else
	f=$((temp-1))
	#Recursive call
	f=$(factorial $f)
	f=$((f*temp))
	echo $f
    fi

--------------------------------------------------    


