# Check if variable is a directory with read and execute bits set. dir_name=/tmp/bar mkdir -m 555 "$dir_name" if [[ -d "$dir_name" ]] && [[ -r "$dir_name" ]] && [[ -x "$dir_name" ]]; then : # do something with the directory fi