News for hackers. Stuff that matters.
Re:The roots of an obscure Bourne shell error message by da39a3ee on Monday September 11, 2023 @11:26PM (#37476693)
For what it’s worth, the explanation of the error was obvious to me after seeing the code for a few seconds. So maybe my point is… don’t worry if stuff like that in shell programming seems obscure to you; it becomes much less obscure with practice (and along the way you do learn genuine lessons about unix-like operating systems, not just shell programming details).
Re:The roots of an obscure Bourne shell error message by rob74 on Tuesday September 12, 2023 @01:54AM (#37477316)
The problem is that most people (me included) don't want to become proficient in writing shell scripts, but they need to write a script (or, God forbid, extend and/or debug a script someone else wrote) from time to time. At least I do it so rarely that I forget most things from one time to the next. I understand that Bash is the way it is because of historical reasons, but maybe some less obscure error messages would be nice? ShellCheck is all nice and well, but Bash itself being more helpful would be better. Or, no, please don't tell me that other tools rely on these error messages and therefore they can't be changed?
Re:The roots of an obscure Bourne shell error message by da39a3ee on Tuesday September 12, 2023 @02:19AM (#37477455)
> maybe some less obscure error messages would be nice?

Bear with me here! The error message is exactly what we’d expect in this situation. The author literally tried to use the string “107” as an executable name, and bash says ‘I can’t find an executable named “107”’.

It’s impossible to be a good software engineer in 2023 without understanding the basics of shell programming. And the absolute number one thing to understand about bash and related shell languages is that “everything is text”. I know one hears people saying that a lot, but you’ve got to really internalize what it means. bash is just constructing strings of text and doing stuff with it. It barely has any non-string data structures.

Re:The roots of an obscure Bourne shell error message by Joker_vD on Tuesday September 12, 2023 @08:22AM (#37479985)
> The author literally tried to use the string “107”

Well, no. That string was not literally used there at all: if it was, there would have been a literal 107 in the user's input. There wasn't.

> It’s impossible to be a good software engineer in 2023 without understanding the basics of shell programming

> bash is just constructing strings of text and doing stuff with it

It's a reassuring knowledge in 2023, after 40 years of countless bugs, exploits, vulnerabilities and accidentally rm-ed important files, the paradigm of "just constructing strings of text and (blindly) doing stuff with it" is still ubiquitously used and one can not be a good software engineer without extensive knowledge of it. Bash truly deserves description of "a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums" much more than APL.

Re:The roots of an obscure Bourne shell error message by da39a3ee on Tuesday September 12, 2023 @11:37AM (#37482875)
[delayed]
Re:The roots of an obscure Bourne shell error message by da39a3ee on Thursday September 14, 2023 @08:15AM (#37507894)
Actually, my use of "literally" is correct as hibbelig points out. I never said that they used the string literal "107". They literally tried to do something which would clearly lead to attempting to use a string representation of an integer as an executable name.
Re:The roots of an obscure Bourne shell error message by hibbelig on Thursday September 14, 2023 @07:36AM (#37507574)
The author literally tried to use 107 as a command.

The author did not try to use literally 107 as a command.

Re:The roots of an obscure Bourne shell error message by throwaway46281 on Tuesday September 12, 2023 @09:03AM (#37480513)
I agree with you. We can complain about Bash all we want, but Bash is everywhere and isn't going anywhere anytime soon (as much as I'd like something better). So if you want to be a good engineer in today's world, you have to learn it. And if the error message isn't immediately obvious to you yet, don't worry, it just means you haven't yet formed the right mental models. But you will, if you continue to educate yourself by reading articles like these!