Live data from Hacker News

Stop Using `rm` in Bash. Use `del`

news.ycombinator.com

51–60 of 76 posts

Re: Stop Using `rm` in Bash. Use `del`

#53
post #50

Earlier 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.

I meant to warn others that, for example, “del foo.iso” could fail due to OOM. As long as they understand that, your use case will work fine for them.

Re: Stop Using `rm` in Bash. Use `del`

#54

As pointed out, the alias should be function del() { mv “$@“ ~/.Trash } instead. Thanks @floatingatoll!

And if you copy and paste that version, it won't work either.

Also, be aware this will silently delete older files with name collisions.

Re: Stop Using `rm` in Bash. Use `del`

#58

My “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.

> Personally I’m not a fan of shell environment customizations like this because they are often fragile and may vary between systems.

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`

#59
post #2

I wish something like this were built into kernel filesystem driver. All deletions automatically go to this specific place in the filesystem.

I would hate that behavior, so if it's brought into Linux at the driver level (which I think is an inappropriate place for it -- the shell is the right place), it should be optional.
Post reply on HN