Hi Luuk,
Thanks for the wonderful comment.
Here is the script I executed :
echo -n Enter the file or directory you want to locate in this backup image :
read text
echo "You entered $text"
sleep 5
echo $text can be found at :
find -iname $text -ls -print 2>/dev/null;
echo Here is the BYTE SIZE, PERMISSIONS, OWNER, DATE and LOCATION of your search result
and the output of the script serves the purpose, Here is the output:
[20150112 16:38:50] root@x3250-m3-21:/ # ./find.sh
Enter the file or directory you want to locate in this backup image :dho
You entered dho
dho can be found at :
2228469 4 drwxr-xr-x 3 root root 4096 Jan 12 10:34 ./root/dho
./root/dho
1704143 4 drwxr-xr-x 2 root root 4096 Oct 29 16:13 ./dho
./dho
Here is the BYTE SIZE, PERMISSIONS, OWNER, DATE and LOCATION of your search result.
I need to fine tune this script, suppose If user enters a file or sub directory, which is not present in the system, the script should output a message saying, this file or directory is not present.
I know, we can do it using IF, THEN statement, for that i need to write if find command output is null then echo, no such file or directory is present in the system.
Can you help me in this please ?