I dunno if I want to test against bash.

And this isn't working yet.
This commit is contained in:
2025-10-01 00:54:45 -04:00
parent 602e0b4fcc
commit fe6c74efa4

29
js4g/fib.bash Normal file
View File

@ -0,0 +1,29 @@
function fib()
{
a=${1}
if (( $a == 0 ))
then
echo 0
elif (( $a == 1 ))
then
echo 1
else
echo $(( $( fib $(( $a - 1 )) ) + $( fib $(( $a - 2 )) ) ))
fi
}
function do_fibs()
{
cnt=${1}
echo ${cnt}
if (( $cnt > 0 ))
then
do_fibs $(( $cnt - 1 ))
echo $( fib $cnt )
else
echo $( fib 0 )
fi
}
do_fibs 38