Fibonacci script
I have this Fibonacci script
#!/bin/bash
if (test $# -ne 1) then
echo "Use: 0ドル number"
exit 1 fi
for c in ‘seq 1 1ドル‘
do
if (($c == 1))
then
n0=1;
echo "fibonacci(1)=$n0";
elif (($c == 2));
then
n1=1;
echo "fibonacci(2)=$n1";
else
n=$(($n0+$n1));
echo "fibonacci($c)=$n";
n0=$n1;
n1=$n;
fi done
type here
I have to made a substitution of the expression evaluation $(($n0+$n1))with the shell command expr $n0 + $n1.
I Rembember that to assign the output of a command to a varible i have to made command > output.txt but I don’t know how to apply it on this exercise. Thank you so much for your help.
lang-bash