severity 736410 minor
found 736410 93u+20120801-1
tag 736410 - patch
thanks
If you follow the links to the stackoverflow page you get to a script
that I am not sure deserves to succeed.
It recurses generating exponential number of subshells. Enabling a patch
that would support that strikes me as risky at best.
Some better code would be:
#/bin/ksh93
#fibonacci sequence function
typeset -i ind=$1
typeset -a fibbo=(0 1)
typeset -i result
if (( $ind >= 2 ))
then
for i in {2..$ind}
do
(( fibbo[$i]=fibbo[$i-1]+fibbo[$i-2] ))
done
fi
(( result = fibbo[$ind] ))
echo fibbonacci sequence number $ind is $result
This does not raise subshells. Hwoever it only goes up 46 before
reaching arithmetical overflow. I am not sure of the implications of
trying to address this, and certainly this does not strike me as a priority.