#!/bin/bash function main { echo "What fib should I calculate?" read n fib $n exit 0 } hello () { echo "Hello" } # declaring the function hello fib () { # $1 is the first arg, $2 second, etc. $0 is the function a=0 b=1 j=$1 for i in $(seq 1 $j) do c=$(expr "$a" + "$b") a=$b b=$c # echo "a $a b $b c $c" done echo "Fibb number $1 is $a" } main