first=0
second=1
echo -n "$first "
echo -n "$second "
for ((index=2 ; index <= $1 ; index++))
do
fibonacci=`expr $first + $second`
echo -n "$fibonacci "
first=$second
second=$fibonacci
done
echo #EOF of Script
OUTPUT:-
#!/bin/bash
#[root@localhost scripts]# ./fibonacci 6
#0 1 1 2 3 5 8
second=1
echo -n "$first "
echo -n "$second "
for ((index=2 ; index <= $1 ; index++))
do
fibonacci=`expr $first + $second`
echo -n "$fibonacci "
first=$second
second=$fibonacci
done
echo #EOF of Script
OUTPUT:-
#!/bin/bash
#[root@localhost scripts]# ./fibonacci 6
#0 1 1 2 3 5 8
0 comments:
Post a Comment