ohmyzsh/plugins/safe-rm/safe-rm.plugin.zsh
2014-04-18 00:12:58 +08:00

16 lines
344 B
Bash

function rm () {
local files
local trash=~/.Trash/
for files in "$@"; do
# ignore any arguments
if [[ "$files" = -* ]]; then :
else
local dst=${files##*/}
# append the time if necessary
while [ -e $trash$dst ]; do
dst=$dst_$(date +%H-%M-%S)
done
/bin/mv $files $trash$dst
fi
done
}