Telaryon

Fájlkereső

Apr 9th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.21 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. read -r a
  4.  
  5. cd Documents
  6.  
  7. if find . -maxdepth 1 -name "$a" -print -quit | grep -q .      
  8.         then
  9.                 echo "The file has been found"                          
  10.                 echo "Here are some details of the file for you:"
  11.                 ls -l "$a"      
  12.                 echo "The path of this file:"
  13.                 readlink -f "$a"        
  14.                 echo "The file type:"
  15.                 file "$a"              
  16.         else
  17.                 echo "I have not found the requested file in the Documents directory."
  18.                 cd                      
  19.                 if find . -maxdepth 1 -name "$a" -print -quit | grep -q .
  20.                         then
  21.                                 echo "The file has been found at:"
  22.                                 readlink -f "$a"        
  23.                                 echo "Here are some details of the file for you:"
  24.                                 ls -l "$a"
  25.                                 echo "The file type:"
  26.                                 file "$a"
  27.                         else
  28.                                 echo "The file does not exist, or you typed it absolutely wrong."              
  29.                 fi
  30. fi
Advertisement
Add Comment
Please, Sign In to add comment