News for hackers. Stuff that matters.
Re:I Accidentally Deleted 7TB of Videos Before Going to Prod... by marcosdumay on Thursday May 05, 2022 @11:43AM (#31274821)
Try not to delete stuff with Bash.

This is the most reliable way. Bash has a few niceties for error handling, but if you are using them, you would probably fare better in another language.

If you do insist on Bash, quote everything, and use the "${var}" syntax instead of "$var". Also, make sure you handle every single possible error.

Re:I Accidentally Deleted 7TB of Videos Before Going to Prod... by ricardobeat on Thursday May 05, 2022 @05:01PM (#31278368)
`set -e` will abort on any error, anywhere in the pipeline. It’s a must for any critical script.