How can I check if a directory exists in a Bash shell script?
Explanation
One has to always remember that always wrap variables in double-quotes when referencing them in a Bash shell script. So always run your script with $DIRECTORY
which you have to set to "My M0viez"
and after that, your script will blow up. So You don’t want that. And to avoid this one should use this.
if [ -d "$DIRECTORY" ]; then
# Will enter here if $DIRECTORY exists, even if it contains spaces
fi
Also, read How do I rename a local Git branch?