Stop Using `rm` in Bash. Use `del`
31–40 of 76 posts
Re: Stop Using `rm` in Bash. Use `del`
#32This 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.
Re: Stop Using `rm` in Bash. Use `del`
#33Personally 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.
Re: Stop Using `rm` in Bash. Use `del`
#34Earlier quoted context omitted.
Now let's delete them after roughtly 30 days: alias del="mv -t ~/.Trash/ ; find ~/.Trash/ -mtime +30 -exec rm {} \;"
This is not fine, as deleting a small file can be very long if there's a large file to be deleted in the trash.
Re: Stop Using `rm` in Bash. Use `del`
#35This 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.
Re: Stop Using `rm` in Bash. Use `del`
#36This 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.
Re: Stop Using `rm` in Bash. Use `del`
#37Earlier 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 {} \;"
mkdir foo; del foo
and including it will spawn file not found errors for the contents of the foo directory, if any.EDIT: See also neighbor comment about appending filenames!
Re: Stop Using `rm` in Bash. Use `del`
#38Re: Stop Using `rm` in Bash. Use `del`
#39For Linux users: also look into the trash-cli [1] package, which complies with the FreeDesktop.org trash specification and remembers the original path, etc. so that trash items can be restored even with filename collisions. Then it's trash-put my_file.txt [1] https://github.com/andreafrancia/trash-cli
I'm not sure about the current state, but one needs to test is very carefully before using it.
Re: Stop Using `rm` in Bash. Use `del`
#40For Linux users: also look into the trash-cli [1] package, which complies with the FreeDesktop.org trash specification and remembers the original path, etc. so that trash items can be restored even with filename collisions. Then it's trash-put my_file.txt [1] https://github.com/andreafrancia/trash-cli
Until at least an year ago, the Ubuntu version (and likely, the upstream on), wouldn't work on certain filesystems. I'm not sure about the current state, but one needs to test is very carefully before using it.