[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I hate it when that happens...



John L Fjellstad wrote:
> ...
> I wrote a script to delete my old email from ~/Mail directory, basically
> this: find $FOLDERS -type f -mtime $AGE -print0 | xargs -0r rm
> 
> Unfortunately, I forgot to add $FOLDERS variable, so it picked ~/, and
> deleted a bunch of old scripts and documents I hadn't touched in
> awhile.  And of course, I didn't have backup....
> 
> Really should have tested the script with an echo before an rm...

And *always* use 'set -u' in shell scripts.  :-)

-- 
Paul
<http://paulgear.webhop.net>
--
Did you know?  Email addresses can be forged easily.  This message is
signed with GNU Privacy Guard <http://www.gnupg.org> and Enigmail
<http://enigmail.mozdev.org> so you can be sure it comes from me.



Reply to: