#!/bin/bash # this script return the fibonacci sequence for the input number if [ $# -lt 1 ] then # use default length limit=50 else # use argument limit=$1 fi # seed the sequence first=1 second=1 echo "Fibonacci sequence up to $limit" echo $first echo $second while [ $second -lt $limit ] do sum=$(( $first+$second )) echo $sum first=$second second=$sum done