I have been trying to debug this loop for a while now (no pun intended!)
I wonder if anyone can tell me if I am missing something obvious
code below
echo enter number of occupants
read occupant_number
echo $occupant_number
i=0
while [$i -lt $occupant_number]
do
echo "Enter occupant${i+1}'s name"
read occupant${i+1}_name
echo "Enter occupant${i+1}'s MAC address"
read occupant${i+1}_macaddress
i=i+1
done
the console output is below:
bash main.sh enter number of occupants 5 5 main.sh: line 7: [0: command not found
Line 7 is the line with the while [$i -lt $occupant_number]
Any help with getting this working is greatly appreciated guys! Thanks