testing dir existence 

According to bash help:

  -f FILE        True if file exists and is a regular file.

It is better to use -e since it can test for symlink too.