News for hackers. Stuff that matters.
Re:How do I prevent accidental rm -rf /*? by pyre on Saturday December 03, 2011 @08:11PM (#3309481)
If any files begin with '-', the second version will just expand to '-filename' which rm will try to process as an option (possibly failing or creating undesired results). Using

  ./*
expands to

  ./-filename
which won't be picked up by option processing. Note: You can also do

  rm -rf -- *
to prevent option processing after the '--'.

edit: added a bunch of breaks to prevent the * from being converted to italics.

There are no comments on this comment yet.