2 ms·
Isn't that kinda the point? Why would that be a bad thing? Seemingly, my version of ls doesn't provide a 'sort alphabetically' flag, but if it did, the equivale
by oneeyedpigeon 10y ago
Isn't that kinda the point? Why would that be a bad thing? Seemingly, my version of ls doesn't provide a 'sort alphabetically' flag, but if it did, the equivalent of
ls | sort | mc
would be something like
ls -C --sort=name
and, as discussed, the ls program has to be much, much more complicated.
- Animats 10y agoUNIX pipeline data is mostly raw strings. To do anything non-trivial, you have to know the format of the previous pipeline item and have a parser for it. It would be amusing to have a system where all commands output JSON, so that pipelined programs can process the previous input. Then you could have ls | sort --key=modification_time | mc For display, you'd have a convention that if there's a "text" field in the JSON, that's what's displayed in the console window. Otherwise you see the raw JSON. So "ls" would output an array of JSON records with all the usual fields, but if you just wrote ls the user would see a list of file names. You could have "format" and "select" programs: ls | select --exclude="owner=root" | sort --key=modification_time | format --fields=name,modification_time,size This would be quite powerful and would allow the creation of complex, functional pipelines. The end result is basically equivalent to SQL, but it's functional!
- sbierwagen 10y agoThis was the point of Powershell, where programs pass around objects, rather than plain text: https://en.wikipedia.org/wiki/PowerShell#Pipeline https://en.wikipedia.org/wiki/PowerShell#Pipeline
- Animats 10y agoCute. So, while Unix is not an acceptable Unix, maybe Windows now is.