Hacker News new | ask | show | jobs
by yolo1 2776 days ago
It's kinda nuts how far the unixy idea of "just streams of text" has gotten us.

As much as I agree that the tooling is, object-based tools would be much nicer.

    for i in `ls`; do echo $i.size; done;
versus

    ls -la | awk '{print $5}'
I know which I'd prefer.
8 comments

This is something that reiserfs was trying to solve (though unfortunately we all know what happened with Hans and Nina Reiser), so most of the ideas have been left on the table.

But yeah, the solution he proposed was to start combining different information namespaces (such as the "metadata" namespace that you are alluding to) into the filesystem namespace, as well as allowing for the filesystem to be pluggable so people could write databases that could be searched with the filesystem.

So your example would look like

    for i in "$(ls)"; do echo $i/..../size; done
And you could do something like

    echo 1000 | tee */..../uid
Which would be equivalent to a chown.
PowerShell is an extremely nice, cross-platform option. Most people are discouraged by the overly long command names (get-childitem and the like), but there are 3 letter aliases (e.g gci) for a lot of the common ones and its really nice.
The second, because when the first fails, you're left with an ls command which is spewing some binary format you can't read without... wait for it... the tool which just failed.

I'd like to ensure my tools are all speaking a format which is too simple to ever fail.

I think you picked the only nice example of powershell in the entire universe (yuck!). Also -- guess which script is shorter....
for unixy tools ... well there are lots more, some have made concessions to be less particular as to who considers them nice or friendly. `ls` is very much in the public relations camp, the flamboyant front man, first point of contact. Behind 'ls' is 'stat' which is more a unixy text stream tool's tool than the human friendly `ls`

    stat -c "%s %n" *
No, that's awful if you consider its implications. Just do:

  for i in *; do du -bs "$i"; done

    > for i in *; do du -bs "$i"; done
    du: illegal option -- b
    usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m | -g] [-x] [-I mask] [file …]
cool
Sounds like you will like PowerShell.
Nobody likes PowerShell. It manages to be the worst of both worlds.
I wasn't aware that people hated it. I very rarely struggle through it (learning curve related, probably) but the objective behavior is something I wish Linux tools would move towards.
It may well be uglier than sin's really ugly cousin, but if you are stuck managing Windows environments, it's a god damned life saver.
Honestly, I'd much rather have seen it be a bunch of console-oriented convenience libs for .NET and focus on making a good REPL console for .NET languages.
Wait a minute. Bash has nice operators like .size ?

Omg

No, that was the point of the parent - that it would be nicer if we did have some object-layer, rather than processing (unstructured) text in pipelines. Losing meta-data at each step.