# rm transform
function rm() {
# garbage collect
now=$(date +%s)
for s in $(ls --indicator-style=none $HOME/.trash/) ;do
dir_name=${s//_/-}
dir_time=$(date +%s -d $dir_name)
# if big than one month then delete
if [[ 0 -eq dir_time || $(($now - $dir_time)) -gt 2592000 ]] ;then
echo "Trash " $dir_name " has Gone "
/bin/rm $s -rf
fi
done
# add new folder
prefix=$(date +%Y_%m_%d)
hour=$(date +%H)
mkdir -p $HOME/.trash/$prefix/$hour
if [[ -z $1 ]] ;then
echo 'Missing Args'
return
fi
echo "Hi, Trashing" $1 "to /root/.trash"
mv $1 $HOME/.trash/$prefix/$hour
}
Hi, Trashing -rf to /root/.trash
mv: invalid option -- 'r'
Try 'mv --help' for more information.