4 ms·
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 tha
by da39a3ee 3y ago
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).
- rob74 3y agoThe 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?
- da39a3ee 3y ago> 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.
- Joker_vD 3y ago> 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.
- da39a3ee 3y agoAgreed, my use of literally was incorrect. But otherwise I don't think we disagree! Bash/zsh etc is a terrible language and it's absurd that knowing it is still required. Nushell is a better direction, but I don't know how the transition's going to be made; I just went back to zsh from nushell.
- da39a3ee 3y agoActually, 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.
- hibbelig 3y agoThe author literally tried to use 107 as a command. The author did not try to use literally 107 as a command.
- deleted 3y ago[deleted]
- throwaway46281 3y agoI 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!