unix if directory code example Example: unix if directory if [ -d "$DIRECTORY" ]; then # Control will enter here if $DIRECTORY exists. fi