I'm trying to create a simple bash script that creates some folders inside another folder but i don't understand what's wrong with an if statement.
#~/bin/bash
MAXNUMBER=10
for((nr=0; nr<$MAXNUMBER; nr++))
do
mkdir "folder"${nr}
if [${nr} -eq 4]
then
for((i=0; i<3; i++))
do
mkdir -p "./folder4/folder"${i}
done
fi
done
Whenever i run this script it gives me this:
./script4.sh: line 6: [0: command not found]
Line 6 is the if statement which looks like it's not working how it should