Thursday, August 24, 2017

Kali Linux update script

I've grown tired of typing in all of the commands to properly update my Kali Linux machine so I put this script together. I place all of my personal scripts in $HOME/bin and add that to my .bashrc (PATH="$PATH:$HOME/bin"). Here it is:

#!/bin/bash
#
CMDS="update upgrade autoclean clean autoremove"
SUDO="sudo"
APTCMD="apt-get"
FORCE="-y"

# add any arg to add dist-upgrade
if [ ! -z $1 ]; then
 CMDS="$CMDS dist-upgrade"
 echo "Adding dist-upgrade"
 echo "Remember to reboot after"
fi


for CMD in $CMDS; do
 DO="$SUDO $APTCMD $CMD $FORCE"
 echo ""
 echo "** Running cmd: $DO"
 ${DO}
 if [ $? -eq 1 ]; then
  echo "*** Something bad happened"
 else
  echo "*** Success"
 fi
done

No comments:

Post a Comment

Current Audible Reading List

Title You Never Forget Your First: A Biography of George Washington A Self-Made Man: The Politica...