Checking If A File Or Directory Exists In Bash
Check For Files (multi-line)
bash
Check For Files (single line)
bash
Using an else
bash
Using the "not" operator
bash
Checking For Directories
To check if a directory exists in a shell script you can use the following:
bash
Or to check if a directory doesn't exist:
bash
Symbolic links can cause issues. See the stack overflow question below for some ways to deal with that
~ fin ~