I move to /tmp and it gets deleted on next reboot.
Stop Using `rm` in Bash. Use `del`
41–50 of 76 posts
Re: Stop Using `rm` in Bash. Use `del`
#42Time Machine.
Re: Stop Using `rm` in Bash. Use `del`
#43I have backups..
Re: Stop Using `rm` in Bash. Use `del`
#44Also, '\rm', as many distributions insist on aliasing 'rm' by default.
Re: Stop Using `rm` in Bash. Use `del`
#45Earlier quoted context omitted.
Even simpler: alias del="mv -t ~/.Trash/"
Now let's delete them after roughtly 30 days: alias del="mv -t ~/.Trash/ ; find ~/.Trash/ -mtime +30 -exec rm {} \;"
del() { mv "$@" ~/.Trash/ && find ~/.Trash -mtime +30 -delete }
I also replaced the unnecessary exec by find's builtin -deleteRe: Stop Using `rm` in Bash. Use `del`
#46Or use a snapshotting filesystem, so you can simply go back in time if you mess up.
Re: Stop Using `rm` in Bash. Use `del`
#47While not an alternative, please bugfix your bash: mv "$@" ~/.Trash/ https://github.com/koalaman/shellcheck/wiki/SC2086
Re: Stop Using `rm` in Bash. Use `del`
#48Re: Stop Using `rm` in Bash. Use `del`
#49This is another example that shows that Bash (and similar shells) should not be used for scripting. It's great for the command line, but for scripting there are much better, cleaner, faster and safer alternatives.
There's plenty of good reasons not to use shellscript, but someone not knowing the difference between "$@" and $* isn't one of them. This is prominently documented in Bash's documentation: https://www.gnu.org/software/bash/manual/html_node/Special-P...
Re: Stop Using `rm` in Bash. Use `del`
#50I move to /tmp and it gets deleted on next reboot.
/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.