Make "rm" Move Files To Trash Instead Of Completely Removing Them

To get the "rm" command to move the file(s) to trash instead of removing them completely, you must install the trash-cli utility and set an alias for "rm" to use trash-cli. But trash-cli also removes folders, even without using the "-r" (recursive) option, so in this post I will share a script created by grizzly which will only remove folders when the "-r" argument is used.