I created a script that helps administrators add and remove users from text file instead of doing it manually. I ran into this error and i'm having trouble solving it.
[ec2-user@ip-172-31-15-55 ~]$ ./account-manager user add
./account-manager: line 21: syntax error near unexpected token `then'
./account-manager: line 21: `   then'
How could I fix this error?
#!/bin/bash
file=$1
action=$2
if [ -z "$file" ]
then
        echo " Please enter a file with your users"
        exit 0
fi
if [ -z "$action" ]
then
        echo " Please define an account to remove or deleete"
        exit 0
fi
for user in `cat $file`
do
        if[ "$action" == "add" ]
        then
                echo adding user: $user
                useradd $user -m -p password
        fi
        if[ "$action" == "remove" ]
        then
                echo removing user: $user
                userdel -r $user
        fi
done
 
     
    