The script which I have requires two inputs one is the
filepath and the other being
filename which is used to check the existence of a file using find command.
#!/bin/bash Filepath=$1 Filename=$2 if [ -z "$Filepath" ] && [ -z "$Filename" ] then echo "Requires Input" elif [ ! -z "$Filepath" ] && [ ! -z "$Filename" ] then Found=`find "$Filepath" -iname "$Filename"` if [ -z "$Found" ] then echo "Not Found" else echo $Found fi fi
This works completely fine as expected.
Later I had to add couple of more conditions to this script i.e. if we get only the
filename as the input parameter the we have search that file in the entire file system as given below
find / -iname "$Filename"
And in case if only the
filepath input parameter is passed to this script then it has to echo that file name parameter is also required or just has to come out.