Last active
May 1, 2020 09:08
-
-
Save igmoweb/684ae94f0e0a35c5fd9746e662f80835 to your computer and use it in GitHub Desktop.
Prevent rm doom!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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