#!/bin/bash

if [ $# -eq 1 ]
then
    Num=$1
else
    echo -n "Enter a Number :"
    read Num
fi

echo "The Fibonacci sequence for the number $Num is : "

f1=0
echo -n "$f1 "
f2=1
echo -n "$f2 "

if [[ $Num -ge 2 ]]; then
i=0
stop=$Num-2
while [[ $i -le $stop ]]
do
let fn=$f1+$f2
echo -n "$fn "
f1=$f2
f2=$fn
let i=$i+1 
done
fi

echo
