File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,8 +69,9 @@ get_all_trash_dirs() {
6969 trash_dirs+=("${HOME}/.local/share/Trash")
7070 fi
7171
72+ local home_mount=$(get_mount_point "$HOME")
7273 local uid=$(id -u)
73- for mount in $(df -h | tail -n +2 | awk '{print $NF}' | grep -v "^/$ home_mount$"); do
74+ for mount in $(df -h | tail -n +2 | awk '{print $NF}' | grep -v "^${ home_mount} $"); do
7475 if [ -d "${mount}/.Trash-${uid}" ]; then
7576 trash_dirs+=("${mount}/.Trash-${uid}")
7677 fi
@@ -157,6 +158,14 @@ rm() {
157158 /bin/rm "$@"
158159 ;;
159160 --empty-trash)
161+ echo "WARNING: Permanently delete all files in trash?"
162+ echo -n "Type 'yes' to confirm: "
163+ read -r response
164+ if [ "$response" != "yes" ]; then
165+ echo "Cancelled."
166+ return 1
167+ fi
168+
160169 local found_trash=0
161170 while IFS= read -r trash_dir; do
162171 if [ -d "$trash_dir/files" ] && [ -n "$(ls -A "$trash_dir/files" 2>/dev/null)" ]; then
@@ -392,10 +401,6 @@ HELP
392401 fi
393402 done
394403
395- if [ $failed -eq 0 ]; then
396- /bin/rm "$@" 2>/dev/null || true
397- fi
398-
399404 return $failed
400405 ;;
401406 esac
You can’t perform that action at this time.
0 commit comments