3 ms·
Another example of catastrophic UX is certainly the unix command 'find', as in: find . -name "*.opa" -exec cat \{\} \; | wc -l I wonder if any Unix beginner
by mabdt 15y ago
Another example of catastrophic UX is certainly the unix command 'find', as in:
find . -name "*.opa" -exec cat \{\} \; | wc -l
I wonder if any Unix beginner has ever managed to find the syntax for -exec without copy-pasting the examples :)
- thwarted 15y agoOne aspect of having composable components is knowing how they get composed. The fact that {} and ; may need to be escaped is something having to do with the shell, not with find and it's -exec syntax. In fact, this is one of those things that is obvious once you learn about shell and how commands lines get expanded and executed. The problem there is that most people don't learn about the shell until forced to by being bitten by something goofy and unintuitive like -exec arguments. The order in which people learn about these things, and it being difficult to discover (in that I can suggest a way to "verify" the command line before running it, but that doesn't help if you don't know how to interpret the results, which also requires experience dealing with the system as a whole) is what causes the catastrophic failure. That these may need to be escaped is even documented in the find(1) documentation. -exec command ; Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command until an argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find. Both of these constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell.