EN
Bash - check if file exists
5 points
In this short article we would like to show how to check if file exists using Bash and test
command.
Simple solution:
xxxxxxxxxx
1
2
3
if [ -e "path/to/my/file/or/directory" ]
4
then
5
echo "File exists";
6
fi
xxxxxxxxxx
1
2
3
if test -e "path/to/my/file/or/directory"
4
then
5
echo "File exists";
6
fi