http://www.perlmonks.org?node_id=468573


in reply to Re^2: /usr/bin/perl -w?
in thread /usr/bin/perl -w?

And Unix commands in general, too! Because of shell design and such, typing rm * in a directory which contains a file named -rf could delete everything (except the file -rf)! You should do rm -- * instead. I have actually been bitten by this once or twice, but luckily not by -rf but something more mundane.

Replies are listed 'Best First'.
Re^4: /usr/bin/perl -w?
by jasonk (Parson) on Jun 21, 2005 at 13:17 UTC

    I've seen some people use this to their advantage too, by creating files called '-i' in directories containing things they don't want to lose. That way an inadvertant rm * will become interactive.


    We're not surrounded, we're in a target-rich environment!