Fix the new summarize feature on check-trash.

This commit is contained in:
Hyperling 2025-01-02 15:59:50 -07:00
parent db3e610c91
commit ae3112d969

View File

@ -281,6 +281,7 @@
unset OPTIND
unset clean
unset network
du_params="-ha"
while (( $# > 0 )); do
case $1 in
-c | -y | --clean )
@ -288,7 +289,7 @@
-n | -net | --network )
network="Y" ;;
-s | -sum | --summarize )
summarize="-s" ;;
du_params="-sh" ;;
* )
echo "
ERROR: Option '$1' with value '$2' not recognized.
@ -322,7 +323,7 @@
$sudo find $dir -name TRASH | while read trash; do
if [[ "$trash" != "" && `$sudo ls -a $trash` ]]; then
echo "Found $trash:"
$sudo du -ha $summarize $trash | sort -h
$sudo du $du_params $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
$sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -332,7 +333,7 @@
$sudo find $dir $maxdepth -name "*"Trash"*" | while read trash; do
if [[ "$trash" != "" && `$sudo ls -a $trash` ]]; then
echo "Found $trash:"
$sudo du -ha $summarize $trash | sort -h
$sudo du $du_params $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
$sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -349,7 +350,7 @@
sudo find $dir -name TRASH | while read trash; do
if [[ "$trash" != "" && `sudo ls -a $trash` ]]; then
echo "Found $trash:"
sudo du -ha $summarize $trash | sort -h
sudo du $du_params $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"
@ -359,7 +360,7 @@
sudo find $dir -name .Trash"*" | while read trash; do
if [[ "$trash" != "" && `sudo ls -a $trash` ]]; then
echo "Found $trash:"
sudo du -ha $summarize $trash | sort -h
sudo du $du_params $trash | sort -h
if [[ "$clean" == "Y" ]]; then
echo "Cleaning trash..."
sudo sh -c "cd $trash; rm -rfv ..?* .[!.]* *"