I am very new to Bash Scripting and can not find any help online for the more basic stuff. My task is to run a program that attempts to take a user input and get it to 1 by dividing even numbers by 2 and multiplying odd numbers by 3 and adding 1. I don't know any advanced commands and I'm sure there are easier ways to do this but I cant quite understand why my code is giving me the "Command Not found" error from gedit.
My code:
#!/bin/bash
#Takes in a number and computes it into hailstone series while
#displaying each number onto the screen
echo Enter number:
read n
while [$n -gt 1]
do
if [$n % 2 -eq 0]
then
let n=n/2
echo $n
else
let n=n*3+1
echo $n the number is header
fi
done
My variable keeps skipping the first if statement and returning my "is header" check statement and I don't want it to. If I input 8 it should be modded by 2 -eq 0, therefore it should divide until it equals 1 or less.