4 ms·
> find > The unix find is a SwissArmyKnife. In PlanNine, the TreeWalking is done by du -- a unix `find . -print` is in PlanNine: `du -a|awk '{print $2}'` Ah,
by JadeNB 7y ago
> find
> The unix find is a SwissArmyKnife. In PlanNine, the TreeWalking is done by du -- a unix `find . -print` is in PlanNine: `du -a|awk '{print $2}'`
Ah, a clearly much more natural replacement.
EDIT: I got downvoted, but I'm not complaining about it, but rather happy to acknowledge the error of my ways. I cut and pasted what I thought was `du -alawk '{print $2}'`, a mish-mash of 5 unexplained command-line switches, one of them duplicated. (I thought the occurrence of the name `awk` among the switches was just a coincidence.) It wasn't until I noticed the downvote that I realised that what I cut and pasted contained not an `l` switch but a pipe, and was much more simple than what I thought. So, thanks, downvoter!
- ori_b 7y agoThere's also walk, at least in 9front: http://man.9front.org/1/walk http://man.9front.org/1/walk
- twoodfin 7y agoMuch better.
- rakoo 7y agoUNIX: To recursively traverse directories, use find(1) Plan 9: find(1) is bloat, use du -a | awk '{print $2}' UNIX: this is complicated to remember and type Plan 9: oh you can also use walk(1) to recursively traverse directories UNIX: so... like find(1) ?
- ori_b 7y agoCompare the manpages for find and walk.
- twoodfin 7y agoI dunno, I agreed with your comment even comprehending the syntax. Using a -a flag to a disk usage utility seems like an odd way to frame an essential building block. Plan 9 doesn’t have a recursive ls?
- nxrabl 7y agoI would guess not, given how the article notes later on that "cp" has no recursion flag: > Imagine how many separate Unix commands have the TreeWalking built into them... RefactorMercilessly. And suggests the following shell script instead: #!/bin/rc switch ($#*) { case 2 @{ cd $1 && tar c . } | @{ cd $2 && tar x } case * echo usage: dircp from to >[1=2] } Which is horrifying (how would you ever figure out what " $#* " means?), even without the context of the article's own dislike and distrust of system customization: > The wide variety of superusers allowed each of them to inflict their style guidelines on the structure of the file system... Now where did that @#!$ superuser put gcc or perl or ... So what's going to happen here? Every time someone wants to list or copy or search or whatever recursively, they're going to have to either write their own potentially buggy variation on this script, or use someone else's. Is there a convention for where they put that script? Every time someone deploys a new Plan9 box, they're probably going to remember that this was a problem before and provide some kind of script like this. Now where did that @#!$ sysadmin put it? The solution to the repeated code problem is a library, not stripping critical functionality from core system utilities and burdening users with unnecessary complexity. Why is this 40 year old operating system making me so angry!? I should get out more.
- stonogo 7y ago> (how would you ever figure out what " $#* " means?) It's in the manual. > Now where did that @#!$ sysadmin put it? The point of Plan 9 is that you don't rely on the sysadmin to put things places for you. You'd mount your home filesystem from wherever it lives and everything would be back to where you expect it. You could even mount /bin from whatever machine you wanted. Plan 9 does not work in pieces. It only works if you're all-in, which is the reason I don't use it. But when you're all-in, it's very nice. None of the things you're objecting to turn out to be problems in practice. The problems in practice come from not having a c++ compiler or a web browser.
- msla 7y ago> You could even mount /bin from whatever machine you wanted. Neat! Now my system is completely unusable if another computer is down or unreachable! And to think people around here bad-mouth cloud computing.
- emmelaich 7y agoI'm with you. The mantra is "do one thing and do it well" So why is du being generalised to a file system walker?