Please follow the following example (please notice that STRING is null)
Get Error
[root@linux /tmp]# STRING=
[root@linux /tmp]# [ $STRING = dog ] && echo "yes its a dog"
bash: [: =: unary operator expected
Syntax without Error
[root@linux /tmp]# STRING=
[root@linux /tmp]# [[ $STRING = dog ]] && echo "yes its a dog"
[root@linux /tmp]# [[ $STRING != dog ]] && echo "yes its a dog"
yes its a dog
Why when I am using Single Square brackets I get - unary operator expected ?
But in case of Double Square brackets the syntax give good results