Recursive function in bash
There are several syntax and a quite obvious logic one (return 0) A working version is below: #!/bin/bash factorial() { if (( $1 <= 1 )); then echo 1 else last=$(factorial $(( $1 – 1 ))) echo $(( $1 * last )) fi } factorial 5 You are missing: return is bad (should use echo) … Read more