Check if File Exists in Bash Script
In this tutorial, you will learn how to use Bash scripts and if statements to check whether or not a file or directory exists. Check if a File Exists Use the -f operator to check if a file exists. This will only check ordinary files, and not directories. #!/bin/bash FILE=”demo/test.txt” if [ -f $FILE ];then […]
Check if File Exists in Bash Script Read More »