2 ms·
The thing is, it's hard to predict what would happen to those scripts regardless... E.g. try naming your files "-rf" and see how many things break :)
by nasretdinov 2y ago
The thing is, it's hard to predict what would happen to those scripts regardless... E.g. try naming your files "-rf" and see how many things break :)
- redserk 2y agoIf one really wanted to embrace chaos, introduce this as a new team file naming standard for "risk finding" files ;)
- tetha 2y agoI do enjoy "ls *; touch -- -lisah; ls *" as a fun little brainteaser for those uninitiated to this behavior.
- ykonstant 2y agoA correct script will have no problems with "-rf" or any other file name. I have (and recommend script writers make their own) a directory hierarchy of "dangerous" file names to test scripts. For example, it contains a directory where all file and subdirectory names are in unary, consisting only of repetitions of the newline character. A correct script should be able to enumerate, access and modify files in there without issue.
- nneonneo 2y agoexport TMPDIR=" / " to surprise the next person or script to do "rm -rf $TMPDIR/foo"...