I trying to control that my file exist or not in directory using if-elif-else statement in for loop. But in if and elif command line gives me this error: No command
Below is an example of the codes:
#! /bin/bash
controlfile="String"
firstfile="String"
lastfile="String"
nsolve=false
for i in $(ls $file1| grep /*.png)
do
    firstfile=${i:0:21} #satır 10
    if ["$firstfile"!="$file2"]; then  #ERROR LINE
                #something doing...
                nsolve=false
        for j in $(ls $file2| grep /*.jpeg)
        do
            if [${j:0:31}==${controlfile:0:31}]; then #.if already jpeg file exist like png
                nsolve=true
                continue 
            else 
                nsolve=false        
            fi
        done
    elif [$nsolve==true]  #ERROR LINE
    then
        #something doing...
        continue    
    fi
    lastfile=${i:0:21}
done
printf "%s\n" "Successfully"
 
    