Search

Llinux Shell Script to check if a file exists

Here a linux shell script which can be used to find if a file exists or not at a given location.



Save the file as checkifFileExist.sh and execute it as shown below.



When prompted enter the file name if you want to check in the current directory or enter the full path to where the presence of the file has to be checked, and the script will show if the file exists or not .



We can use the following script if we want to pass the file name to be searched for as a command line argument.

Save the file as checkifFileExist.sh and execute it as shown below.

1 comment: