torsdag 5 mars 2015

Linux - Bash - empty trash in terminal if yes

#!/bin/bash
clear
version="0.0.3"
trashdir="/home/hynt/.local/share/Trash"

#Show Trash Folder Size
clear && echo Folder Trash Size: && du -csh  $trashdir

#----------------------------------------------------------------------
echo "Would you like to empty Trash  [y/n]?"
read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]
then
cd $trashdir
sudo rm -rf *
fi
if [ $ans = n -o $ans = N -o $ans = no -o $ans = No -o $ans = NO ]
then
fi
#----------------------------------------------------------------------
echo "hynt@speed-mailer.com" 
echo "htrash.sh $version"

Inga kommentarer: