#!/bin/bash
########### to check for a directory ###########
path="./folder"
if [[ -d $path ]]; then
echo "$1 Directory exists"
fi
# or
[ -d "folder" ] && echo Directory exists
########### to check for a file ###########
path="./file.txt"
if [[ -f $path ]]; then
echo "$1 File exists"
fi
# or
[ -f "file.txt" ] && echo file exists