We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 815af03 commit 26a8b00Copy full SHA for 26a8b00
rmtomv.sh
@@ -0,0 +1,40 @@
1
+###重定义rm命令###
2
+
3
+#定义回收站目录
4
+trash_path=’~/.trash’
5
6
+#判断$trash_path 定义的文件是否存在,如果不存在,那么就创建$trash_path.
7
+if [ ! -d $trash_path ]; then
8
+mkdir -p $trash_path
9
+fi
10
11
+#定义别名:使用rm就调用trash
12
+alias rm=trash
13
14
+#使用rl就调用’ls ~/.trash’ 如果更改上面的回收站目录这里的目录也需要修改
15
+alias rl=’ls ~/.trash’
16
17
+#使用unrm就调用restorefile
18
+alias unrm=restorefile
19
20
+#使用rmtrash就调用claearteash
21
+alias rmtrash=cleartrash
22
23
+#恢复文件的函数
24
+restorefile()
25
+{
26
+mv -i ~/.trash/$@ ./
27
+}
28
29
+#删除文件的函数
30
+trash()
31
32
+mv $@ ~/.trash/
33
34
35
+#清空回收站的函数
36
+cleartrash()
37
38
+read -p “确定要清空回收站吗?[y/n]” confirm
39
+[ $confirm == ‘y’ ] || [ $confirm == ‘Y’ ] && /bin/rm -rf ~/.trash/*
40
0 commit comments