Check if a file exists in a linux script
17,874
if [[ -e "$1/file.txt" ]]; then
echo "It exists"
fi
Author by
ALex
Hi, I am Alexandru Antonica, a fullstack software engineer based in Bucharest, Romania, for more than 3 years now. I have started as a backend developer but curiosity and desire of knowledge made me want to be more independent when it comes to software development and technologies used in the process, as proof I have also a CKAD (Certified Kubernetes Application Developer) certification. Also I've created a course on Udemy on how to create a fullstack web application from scratch, using spring boot, kubernetes, angular, CI/CD pipelines etc.
Updated on June 04, 2022Comments
-
ALex almost 2 years
i made a linux script which receives as first argument a path to a directory. I don't know the path. And i want to check if "file.txt" exists at that certain path . For example :
if [ -e $1/file.txt ];then echo HAHA fi