diff --git a/FileExists/README.md b/FileExists/README.md new file mode 100644 index 0000000..fafb467 --- /dev/null +++ b/FileExists/README.md @@ -0,0 +1,20 @@ + +This script is really helpful to check if a particular file exists or not in a particular folder and at the same time it is very simple to use, one with less or no experience on CLI can also execute the script + +Just Follow the steps + +-Download the script in the pc where we need to check the presence of the file +-Open terminal or Command Prompt +-Type "chmod +x script4.sh" to give it executable permission +-now to go the folder where you need to check the file +-write the command "bash script4.sh +-IMP don't forget to write the complete name of the file, for instance "bash script4.sh book.txt" + + +How this help and makes your life easier. + +Incase of any query feel free to connect. + +Thank You +Varun Bansal + diff --git a/FileExists/script4.sh b/FileExists/script4.sh new file mode 100644 index 0000000..9ef3ded --- /dev/null +++ b/FileExists/script4.sh @@ -0,0 +1,7 @@ +#!/bin/bash +filename=$1 +if [ -f "$filename" ]; then +echo "File exists" +else +echo "File does not exist" +fi