Skip to content

Instantly share code, notes, and snippets.

@gurkanakdeniz
Created October 13, 2018 19:46
Show Gist options
  • Save gurkanakdeniz/a1b7e452230e6da51a35cc854815375a to your computer and use it in GitHub Desktop.
Save gurkanakdeniz/a1b7e452230e6da51a35cc854815375a to your computer and use it in GitHub Desktop.
Bleachbit script for terminal run
#!/bin/sh
FORCE=false
SLIENT=false
HELP=false
OPTS=`getopt -o fsh: --long force,slient,help`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
while true; do
case "$1" in
-f | --force ) FORCE=true; shift ;;
-s | --slient ) SLIENT=true; shift ;;
-h | --help ) HELP=true; shift ;;
-- ) shift; break ;;
* ) break ;;
esac
done
if $HELP ; then
echo "\n -h , --help : help, this page"
echo " -f , --force : don't ask, clear"
echo " -s , --slient : slient, only with --force parameters\n"
else
if $FORCE;then
#if $SLIENT; then
# {bleachbit -c --preset} 2>/dev/null
# echo "Slient!"
#else
# bleachbit -c --preset
#fi
bleachbit -c --preset
echo "Finish!"
else
bleachbit -p --preset
echo -n "\nAre you sure (y/n)?: "
read isOk
if ( (echo "$isOk" | grep -iq "^e") ||
(echo "$isOk" | grep -iq "^y")) ;then
bleachbit -c --preset
echo "Finish!"
else
echo "Cancel!"
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment