5 ms·
The `let ++` example is pretty damning. I find Bash to be a poor and outdated shell that we’re stuck with for now. Its design is the best argument against LSD I
by stevebmark 4y ago
The `let ++` example is pretty damning. I find Bash to be a poor and outdated shell that we’re stuck with for now. Its design is the best argument against LSD I know, it came out of the hippie drug days, and Bash reflects that with its madness.
- somat 4y agoA lot of the sins of shell are from it's primary role as an interactive interface to the computer. it's use as a scripting language was a nice secondary goal. On the one hand it is nice to have your interactive interface and your scripts be the same language. on the other it is a bit horrifying the way all those convenient interactive features make your programs so prone to failure.
- justin_oaks 4y agoWe'd probably all be better off if our scripts weren't in the same language as used by our interactive interface. I do paste snippets of scripting (if, for, etc.) into my interactive terminal from time to time, but that's rare compared to just typing commands to run. I wouldn't mind it if all scripting in the shell had to be offloaded to a completely separate language that was less error prone and more consistent.
- trashtester 4y ago> The `let ++` example is pretty damning. Seems kind of logical, the following c code behaves the same way. #include <stdio.h> int test(void) { int i=0; return i++; } void main(void) { printf("i = %d\n", test()); } 'let i++' evaluates to / returns 0 before increasing i, just like c would.
- stevebmark 4y agoI don't mean what it returns, I mean that returning non-zero trips up Bash into thinking it's a non-successful error code. The fact that doing math can trip up error detection implies a fundamental design flaw of the system. Which, I mean, we're in Bash, of course it's poorly designed. I didn't know it was quite this bad though.
- ohiovr 4y agoInteresting.. that might be part of why I fell in love with this ugly monster called Bash scripting.