'[-d: command not found [closed]

As per this answer: Unix Bash Shell Programming if directory exists, I'm trying to check if a directory exists. However, when I run this, I get line 1: [-d: command not found. What am I doing wrong here?

if [-d "~/.ssl"]; then
  echo '~/.ssl directory already exists'
else
  sudo mkdir ~/.ssl/
fi


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source