I have this code here and what its supposed to do it this:
the user enters the Max number. and based on that number entered, I want to display all the even numbers up to that number.
#! /bin/bash
echo "What is your max number:"
read counter
for number in {0.."$counter"}
if [ (($number % 2 == 0)) ]
then
echo "$number"
fi
but it doesn't work. rather I receive this error when I call he script from the terminal:
[root@sunshine Desktop]# bash Tester
What is your max number:
9
Tester: line 9: syntax error near unexpected token `if'
Tester: line 9: `if [ (($number % 2 == 0)) ]'