-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtra_cl.sh
40 lines (34 loc) · 823 Bytes
/
tra_cl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/zsh
#
# /
# |_| >_
#
#
# tra.sh: zsh scripts for trash management
# https://marie-helene-burle.netlify.com
# https://github.com/prosoitos
# https://twitter.com/MHBurle
# msb2@sfu.ca
#
# GNU Affero General Public License
#
#
# This script empties the trash
# topdir=$(findmnt -T . -n -o TARGET)
# if [[ $topdir = /home ]]
# then
# trash_path=$HOME/.local/share/Trash
# else
# # trash_path=$topdir/.Trash
# trash_path=$topdir/.Trash-1000
# fi
trash_path=$HOME/.local/share/Trash
# save stderr in file descriptor 3
exec 3>&2
# do not show stderr (prevents error when trash is empty)
exec 2> /dev/null
# -f flag to delete files/dirs regardless of permission
rm -r -f $trash_path/files/*(D)
rm -r -f $trash_path/info/*(D)
# restore stderr to prevent an exit 1
exec 2>&3