[root@test ~]# hsz(){ D=/tmp/$(date +%Y%m%d%H%M%S); mkdir -p $D; mv "$@" $D && echo "moved to $D ok"; } #定义别名 在文件夹/tmp 下创建 一个 时间为名称的 目录
[root@test ~]# alias rm='hsz'
[root@test ~]# touch 1.txt
[root@test ~]# ls 1.txt
1.txt
[root@test ~]# rm 1.txt
moved to /tmp/20181211094006 ok
[root@test ~]# ls /tmp/20181211094006/
1.txt
[root@test ~]#
转载自 https://codingstandards.iteye.com/category/126457
微博中的某一篇文章。