4 ms·
While GNU's not unix... afaik GNU coreutils' rm has done exactly what you expect it to when given a single dash as an argument for who knows how long. The prob
by YSFEJ4SWJUVU6 9y ago
While GNU's not unix... afaik GNU coreutils' rm has done exactly what you expect it to when given a single dash as an argument for who knows how long.
The problem is names that could be interpreted like options, like '-f' or '--help'.
- mort96 9y agoInterestingly, when the shell expands * , it won't do anything to make sure files starting with - are handled properly. This means, if you're in a directory with the files a, b, -rf, and the directories foo/ and bar/, running "rm * " will not delete all the files and keep all the directories; instead it will be turned into "rm a b bar foo -rf", meaning it will delete all the files and directories except for the file -rf.
- xelxebar 9y agoI've definitely run into this on bash and zsh (iirc). I'm curious if this glob expansion behaviour is set in posix somewhere.