4 ms·
Surely the problem is the 'Everything is a stream of bytes' model? Eg: Ls | foo | bar Ls just prints nl separated strings, no metadata, nothing to tell you w
by benj111 8y ago
Surely the problem is the 'Everything is a stream of bytes' model?
Eg:
Ls | foo | bar
Ls just prints nl separated strings, no metadata, nothing to tell you what it is.
In current practical terms that means avoiding the shell, that isn't inherent though. I guess powershell avoids this issue.
- JdeBP 8y agoHence Greg Wooledge's famous advice not to parse the output of ls. As catern points out, in a fully-fledged systems programming language, one can just directly call the library routines that read directories. And thereby obtain metadata without having to parse it from locale-dependent forms, too. * https://mywiki.wooledge.org/ParsingLs https://mywiki.wooledge.org/ParsingLs * https://unix.stackexchange.com/a/503711/5132 https://unix.stackexchange.com/a/503711/5132