Skip to content

Instantly share code, notes, and snippets.

@vanmik
Created December 1, 2011 03:51
Show Gist options
  • Save vanmik/1413402 to your computer and use it in GitHub Desktop.
Save vanmik/1413402 to your computer and use it in GitHub Desktop.
make rm() move files to Trash
function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
done
mv "$path" ~/.Trash/"$dst"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment