3 ms·
What do you mean some OSs? It works fine on Linux and bash. With zsh I have to expand the * to make it work.
by NullPrefix 5y ago
What do you mean some OSs?
It works fine on Linux and bash.
With zsh I have to expand the * to make it work.
- ninkendo 5y agoNo OS is special here, nor is ZSH/bash... Tried this with bash on linux: $ touch -- -rf $ mkdir subdir1 $ touch subdir1/test1 $ rm * $ ls -rf $ With zsh it's almost the same, it just warns me first: $ touch -- -rf $ mkdir subdir1 $ touch subdir1/test1 $ rm * zsh: sure you want to delete all 2 files in /path/to/test [yn]? y $ ls -rf $ Since there was a file called -rf, `rm *` expands to `rm -rf subdir1`, and that's what it does. The actual file named -rf survives because -rf was interpreted as an option rather than a filename. It would only have been removed if I did `rm -rf -- *`.