4 ms·
This is a strawman. It's trivially easy to do what you're describing. ls | xargs rm And in fact, a better implementation is rm * The Unix philosophy
by ball_of_lint 3y ago
This is a strawman. It's trivially easy to do what you're describing.
ls | xargs rm
And in fact, a better implementation is
rm *
The Unix philosophy doesn't say "Every program interfaces intuitively and correctly with every other program". It says that programs should be able to work together. There are arguments that coreutils such as ls aren't following the Unix philosophy, but they lie much more in that ls has dozens of arguments than they do in your contrived example not working.
- zucker42 3y agoThe fact that the first example has a bug (it doesn't handle file names with spaces correctly) sort of proves the point of the commenter you responded to. I personally don't use nushell (or another alternative, oil) because bash for scripting and zsh for interactive shell is good enough for me, and compatibility with other people is valuable. However, whenever you start to write slightly complex scripts in bash, you have to think carefully about spaces in file names and other similar problems. Of course, you can argue you should just write those scripts in Python, but shell is a lot quicker to write and would be more elegant if it had fewer footguns and less esoteric syntax.
- IshKebab 3y ago`ls | xargs rm` is still wrong. Maybe you can accept the point...