How to check if a file or directory exists in Bash

Many times when writing Shell scripts, you may find yourself in a situation where you need to perform an action based on whether a file exists or not. In Bash, you can use the test command to check whether a Read More …