Just a little fun thing to do on a unix console.

  • Create a new directory with a sub directory: mkdir test; cd test; mkdir sub
  • When trying to delete everything in test with rm *, one gets this message rm: sub: is a directory.
  • Create a file named ‘-rf’ with touch ./-rf and retry rm *. It (surprisingly?) works.

The wildcard * is substituted by -rf sub and given to the rm command which interprets -rf as parameter.

This could probably be used in very creative ways…