Comment by ๐ stack
I just figured out that TSV is not like CSV, as it does not escape the data. Definitely more sensible.
I am kind of surprised there is no universal support for the ASCII field and record separator characters...
Jan 11 ยท 4 months ago
5 Later Comments โ
โต๏ธ dsp ยท Jan 12 at 10:05:
isn't there stat + du there to get everything out of the fs already instead of ls?
๐ stack [OP] ยท Jan 12 at 18:58:
Yes, stat is yet another variation on the theme -- it can do what ls does and more:
Again, it does everything. You can get stat to output TSV I suppose, as it has a finer control of what is printed.
However, if you just want names of files in a directory there is no need to stat each file, right?
โต๏ธ dsp ยท Jan 13 at 05:41:
i got used to using du for traversing a dirent. i know that disk usage doesn't sound like the right name of a command for that. in the plan9 mailing lists i believe to have seem more than once the need for an abstracted command to walk a tree in order to capture what -R or du are doing here. i guess this paired with stat in some cases (cause you might be walking a VFS where stat almost makes no sense) and something to do the presentation is what could be the parts of ls you are talking about.
๐ jsreed5 ยท Jan 13 at 16:52:
This is a tricky problem. In most Unix-like systems, the only character that cannot appear anywhere in a path is NUL. Therefore, NUL is the only character that could unambiguously separate paths in a listing. However, NUL is also used to terminate strings in C, so most POSIX utilities have undefined or unspecified behavor upon encountering it. Usually, they either strip the NULs or give an error.
It's a double-edged sword: by nature, a tool that could list any possible set of paths perfectly couldn't have its output processed as text by other tools, because the only entry separator that works perfectly is usually not allowed in text. I wouldn't be surprised if that's why `ls` was designed the way it was in the first place.
๐ฆ zzo38 ยท Jan 14 at 00:20:
Other alternatives are binary formats, such as DER or SDSER formats. (In my idea of operating system design it does use something similar, rather than only text output; it is possible to make programs that do something similar on UNIX as well (although it is not quite the same, but can be similar).)
Original Post
โ spell.mywire.org:1960/~stack/0257.gmi
ls but The Unix Way โ Where I build a composable ls toy...