Advertisement
v1ral_ITS

easily search gdrive GUI PROGRAM

Jul 19th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.88 KB | None | 0 0
  1. #!/bin/bash
  2. # yes/no question
  3. if zenity --question --text="Do You Want To Upgrade Your .drv Document?"; then
  4.      drive list -m 10000000 >> /home/g0ne_/.drv
  5.   else
  6.     zenity --info --width=560 --title="Begining .. " --timeout 20 --text="<b>Please Wait:</b>"
  7. fi
  8. function menu {
  9.  
  10. # Input Dialog
  11. input=$(zenity --title=" Grep GUI " --width=560 --text "   Enter Source and Target" --forms --add-entry "Search_Phrase" --add-entry "Target_Document")
  12.  
  13. ret=$?
  14.  
  15. # Is clicked exit, then exit.
  16. [[ $ret -eq 1 ]] && exit 0
  17.  
  18. # Error handling source. If nothing was entered return to menu.
  19. if [ -z "$(echo $input | awk 'BEGIN {FS="|" } { print $1 }')" ]; then
  20.     zenity --width=560 --warning="No Searh Phrase Typed" --text="<b> No Search Specified.</b>\n\n Please Specify Search Phrase. \n\n Back to menu ..."
  21.     menu
  22. fi
  23.  
  24. # Error handling target. If nothing was entered return to menu
  25. if [ -z "$(echo $input | awk 'BEGIN {FS="|" } { print $2 }')" ]; then
  26.     zenity --width=560 --warning="No target document typed" --text="<b> No target document specified.</b>\n\n Please specify target. EX: /home/$USER/movie.list\n\n Back to menu ..."
  27.     menu
  28. fi
  29.  
  30. }
  31. menu
  32. Search_Phrase=$(echo $input | awk 'BEGIN {FS="|" } { print $1 }')
  33. Target_Document=$(echo $input | awk 'BEGIN {FS="|" } { print $2 }')
  34.  
  35. export Search_Phrase
  36. export Target_Document
  37.  
  38. # Pre warning dialog.
  39. zenity --info --width=560 --height=40 --title="Starting Search.. " --timeout 2 --text="<b> Operation is starting ...  Please wait ..... </b>"
  40.  
  41.  
  42. # Start and show a pulsating progressbar.
  43. grep $Search_Phrase $Target_Document > /tmp/grep | kdialog --title "Results!" --textbox /tmp/grep 5000 400
  44. # Success dialog.
  45. zenity --info --width=560 --title="End .. " --timeout 20 --text="<b>Success:</b><span color=\"blue\">  Operation has been successfully finalized.</span> \n\n<b>Searched: $Search_Phrase    ------>    Target Document: $Target_Document</b>"
  46. exit 0
  47. # End here.
  48. echo ""
  49. sudo rm /tmp/grep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement