Advertisement
v1ral_ITS

EXTREMELY PROUD ez-apt EXAMPLE SCRIPT [ lessons 101 ]

Feb 17th, 2018
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.44 KB | None | 0 0
  1. ############################################################################################
  2. # PLEASE NOTE OPTIONS KILL_PROCESS IS ANOTHER SCRIPT OF MINE SHARED NOW BEFORE MAIN SCRIPT #
  3. ############################################################################################
  4. #
  5. #!/bin/bash
  6. # Author : v1ral_ITS
  7. process=`ps -u $USER | zenity --list --column "Please select a process to kill:" --text="List all $USER processes:" --width 450 --height 570`
  8.  
  9. ans=`echo $?`
  10.  
  11.     if test "$ans" -eq "0" ;
  12.     then
  13.  
  14.         select=`echo $process | cut -d" " -f1`
  15.  
  16.         kill $select
  17.             ans1=`echo $?`
  18.             if [ "$ans1" == "0" ] ;
  19.             then
  20.             select1=`echo $process | cut -d":" -f3  | cut -d" " -f2`
  21.             echo | zenity --info --text="Process '$select1' with pid '$select' was killed!" --width 400 --height 150
  22.             else
  23.             echo | zenity --error --text="Process '$select1' with pid '$select' not found!" --width 200 --height 100
  24.             fi
  25.     exit 0
  26.     fi
  27.  
  28.     if test "$ans" -eq "1" ;
  29.     then
  30.     echo | zenity --error --text="You have cancel" --width 200 --height 100
  31.     exit 0
  32.     fi
  33.  
  34.  
  35.  
  36.  
  37.  
  38. #!/bin/bash
  39. #######################
  40. # Bash Menu Scripting #
  41. ################################
  42. # GLOBAL VARIABLES IN ALL CAPS #
  43. #########################################################################################
  44. #########################################################################################
  45. ##                                                                                     ##
  46. #  v1ral_ITS   |   ImPerialTeKSolutions@outlook.com   |   www.pastebin.com/u/v1ral_ITS  #
  47. ##                                                                                     ##
  48. #########################################################################################
  49. #########################################################################################
  50. # Console colors
  51. W='\033[0m'  # white (normal)
  52. R='\033[31m'  # red
  53. G='\033[32m'  # green
  54. O='\033[33m'  # orange
  55. B='\033[34m'  # blue
  56. P='\033[35m'  # purple
  57. C='\033[36m'  # cyan
  58. GR='\033[37m'  # gray
  59.  
  60. #####################
  61. # START             #
  62. #####################
  63.  
  64. PS3='Please enter your choice: '
  65. options=("`echo -e $O Update`" "`echo -e $B Upgrade`" "`echo -e $C Install`" "`echo -e $G Autoremove`" "`echo -e $P Purge`" "`echo -e $W Kill_Processes`" "`echo -e $C Clear Screen`" "`echo -e $GR Enter Your Own Command`" "`echo -e $P Quit`")
  66. select opt in "${options[@]}"
  67. do
  68.     case $opt in
  69.         "`echo -e $O Update`")
  70.             sudo apt-get -y update
  71.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  72.             ;;
  73.         "`echo -e $B Upgrade`")
  74.             sudo apt-get -y upgrade
  75.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  76.             ;;
  77.         "`echo -e $C Install`")
  78.             echo -n "What do you want to install?: "
  79.             read INST
  80.             sudo apt-get -y install $INST
  81.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  82.             ;;
  83.         "`echo -e $GR Autoremove`")
  84.             sudo apt-get -y autoremove
  85.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  86.             ;;
  87.         "`echo -e $P Purge`")
  88.             echo -n "What do you want to purge?: "
  89.             read PGE
  90.             sudo apt-get -y purge $PGE
  91.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  92.             ;;
  93.         "`echo -e $W Kill_Processes`")
  94.             echo -e $R"`killps`"
  95.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  96.             ;;
  97.         "`echo -e $C Clear Screen`")
  98.             echo -e $O"`clear`"
  99.             echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  100.             ;;
  101.     "`echo -e $GR Enter Your Own Command`")
  102.         MSG=$(zenity --title "Terminal Command Entry" --entry )
  103.         sudo $MSG
  104.         echo -e $C"Your options again are, press [E]nter \n `echo $options`"
  105.         ;;
  106.         "`echo -e $P Quit`")
  107.             break
  108.             ;;
  109.         *) echo invalid option;;
  110.     esac
  111. done
  112. echo -en "Please Email us @ ImPerialTeKSolutions@outlook.com for any and all questions comments, freelance work, and any other projects. We like feedback, thanks!"
  113. sleep 4
  114.  
  115.  
  116. # Console colors ##############
  117. W='\033[0m'  # white (normal) #
  118. R='\033[31m'  # red           #
  119. G='\033[32m'  # green         #
  120. O='\033[33m'  # orange        #
  121. B='\033[34m'  # blue          #
  122. P='\033[35m'  # purple        #
  123. C='\033[36m'  # cyan          #
  124. GR='\033[37m'  # gray         #
  125. ###############################
  126. #     REMINDER            #
  127. ###############################
  128.  
  129. cd "`pwd`";
  130.     echo -e \n\n\n`clear`;
  131.     echo -e $GR" `date` ";
  132.     echo -e $O" Shell Scripts Made For You........";
  133.     echo -e $P" Your present working directory is `pwd`...";
  134.     echo -e Inside....
  135.     ls;
  136.     echo -e $W"  
  137.    $R########################################################$G##################################################################
  138.     $G#####         *                                                                   $R  *                   ####
  139.    $GR#####         SHELL SCRIPTS MADE EASY FOR THE LINUX USER      $C    2018_vet   ImP.TeK_Solutions TM                     ####
  140.     $G#####         *                                                                           $R  *                   ####
  141.    $R########################################################$G##################################################################
  142.    "
  143. date
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement