While I don't write in Bash, I do know that you don't need more than two variables, at the most, to compute the Fibonacci sequence.
In fact, you're very close to doing so.
Just sort of manipulating your code here,
# first was never used, it was not required
second=1 # Somewhat confusing name, consider something different
third=1 # Same here.
echo -n "Term: "
read -r term # Using the -r argument was recommended after research
# Notice this functions without the beginning section
for ((i=1; i<term; i++))
If you were to apply this code to your picture above, simply replace all instances of
The modified code should display
2*term-2 numbers, (Your code as it is now displays more,
To change this so it only displays
term numbers, change
term so it's the proper upper limit after you've read it.
So, the code could look something like this:
for ((i=1; i<term/2+1; i++))
Tested it and yes, the code does work.