Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save denysdovhan/0080d1bdcf5a43d19265e3b7225618f1 to your computer and use it in GitHub Desktop.
Save denysdovhan/0080d1bdcf5a43d19265e3b7225618f1 to your computer and use it in GitHub Desktop.
iterm / oh-my-zsh -> rm move to .trash
#add script to .oh-my-zsh/lib/functions.zsh
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
/bin/mv "$path" ~/.Trash/"$dst"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment