Simple Shell script help IF ELSE METHOD

I am a beginner at shell scripting and was trying to attempt this question : Write a shell script to prompt the user to input her/his age and print it on the screen only if the entered age is less than 30 (e.g. 20

However, when I run the script below and enter in a number when prompted I get this error ":agescript: line 6: [5: command not found"

# Age script thing

echo "Hello, how old are you?"
agelimit=30
read agoe
if ["$agoe" -lt "$agelimit" ]; then
	echo "you're $agoe years old" 
	exit 0
	else
   	echo "you're old mate" 
	exit 0
	fi

Welcome to the forum.

You need to enclose both the [ command and the trailing ] in spaces.

2 Likes

In this line

if ["$agoe" -lt "$agelimit" ]; then

insert space atter braket

if [ "$agoe" -lt "$agelimit" ]; then
1 Like

thanks so much guys!!

1 Like