Reference

Bash File Test Operators

October 5, 2022

Usage Example:

if [[ -e "$file" ]]; then
  echo "pass"
else
  echo "does not pass"
fi
Operator Meaning
-e File exists
-s File exists and is not empty
-d File exists and is a directory
-f File exists and is a regular file
-v Variable is set and been assigned a value
-z String is zero
-n String is non-zero

Reference (Bash Man Page)