File Test Operators
File Test Operators
Returns true if
-e
and-a
file exists-s
file is not zero size i.e. not empty-f
file is a regular file i.e. not a directory-d
file is a directory-h
and-L
file is a sympbolic link
Check if a file exists
if (-e foo.txt ); then
echo "foo.txt already exists!"
else
// Do something
fi