Created Sc2035 (markdown)

koalaman
2013-11-10 12:01:17 -08:00
parent 4844d73c89
commit ea99b9cf28

15
Sc2035.md Normal file

@@ -0,0 +1,15 @@
# Use ./*.m3u so names with dashes won't become options.
### Problematic code:
rm *
### Correct code:
rm ./*
### Rationale
Since files and arguments are strings passed the same way, programs can't properly determine which is which, and rely on dashes to determine what's what.
A file named `-f` (`touch -- -f`) will not be deleted by the problematic code. It will instead be interpreted as a command line option, and `rm` will even report success.
Using `./*` will instead cause the glob to be expanded into `./-f`, which no program will treat as an option.