logoalt Hacker News

ameliusyesterday at 10:54 PM9 repliesview on HN

It's a reminder of how archaic the systems we use are.

File descriptors are like handing pointers to the users of your software. At least allow us to use names instead of numbers.

And sh/bash's syntax is so weird because the programmer at the time thought it was convenient to do it like that. Nobody ever asked a user.


Replies

zahlmanyesterday at 10:59 PM

At the time, the users were the programmers.

show 2 replies
agentdrektoday at 1:00 AM

It should be a lesson to learn on how simple, logical and reliable tools can last decades.

show 3 replies
xenadu02today at 12:38 AM

> At least allow us to use names instead of numbers.

You can for the destination. That's the whole reason you need the "&": to tell the shell the destination is not a named file (which itself could be a pipe or socket). And by default you don't need to specify the source fd at all. The intent is that stdout is piped along but stderr goes directly to your tty. That's one reason they are separate.

And for those saying "<" would have been better: that is used to read from the RHS and feed it as input to the LHS so it was taken.

csoursyesterday at 11:11 PM

The conveniences also mean that there is more than ~one~ ~two~ several ways to do something.

Which means that reading someone else's shell script (or awk, or perl, or regex) is INCREDIBLY inconvenient.

show 1 reply
nusltoday at 1:35 AM

I quite like how archaic it is. I am turned off by a lot of modern stuff. My shell is nice and predictable. My scripts from 15 years ago still work just fine. No, I don't want it to get all fancy, thanks.

spiralcoastertoday at 1:02 AM

Who do you imagine the users were back when it was being developed?

show 1 reply
gdevenyitoday at 1:40 AM

The programmers were the users. They asked. They said it was ok.

jballanctoday at 1:44 AM

Wait until you find out where "tty" comes from!

HackerThemAllyesterday at 11:06 PM

> bash's syntax is so weird

What should be the syntax according to contemporary IT people? JSON? YAML? Or just LLM prompt?

show 6 replies