function del() {
mv “$@“ ~/.Trash
}
instead. Thanks @floatingatoll!Stop Using `rm` in Bash. Use `del`
51–60 of 76 posts
Re: Stop Using `rm` in Bash. Use `del`
#52While not an alternative, please bugfix your bash: mv "$@" ~/.Trash/ https://github.com/koalaman/shellcheck/wiki/SC2086
Re: Stop Using `rm` in Bash. Use `del`
#53Earlier quoted context omitted.
/tmp is a ramdisk on some systems, which makes this particular approach a very risky endeavor to use as a global replacement for ‘rm’ as the OP suggests.
Sure, also it works for me because it is on a system that is frequently turned off. If it would have to stay on for a long time it would fill /tmp with garbage.
Re: Stop Using `rm` in Bash. Use `del`
#54As pointed out, the alias should be function del() { mv “$@“ ~/.Trash } instead. Thanks @floatingatoll!
Also, be aware this will silently delete older files with name collisions.
Re: Stop Using `rm` in Bash. Use `del`
#55Re: Stop Using `rm` in Bash. Use `del`
#56`brew install trash`
Re: Stop Using `rm` in Bash. Use `del`
#57Re: Stop Using `rm` in Bash. Use `del`
#58My “alternative” to rm is to use mv directly. I just mv files aside whenever I am not 100% confident they are safe/ready to delete permanently. Personally I’m not a fan of shell environment customizations like this because they are often fragile and may vary between systems. I like to know exactly what commands I’m executing.
True. I gave up the practice entirely many years ago for a slightly different reason -- I need to use many different systems on a regular basis, and don't want to get used to using something custom that won't exist on random system X without customizing it, too.
Often, I prefer predictability and stability over convenience.
Re: Stop Using `rm` in Bash. Use `del`
#59I wish something like this were built into kernel filesystem driver. All deletions automatically go to this specific place in the filesystem.