This is usually because the script is generated and targeting different or old versions of bash or sh, where precise semantics of things like $* might not be guaranteed.
Manually and the bot are essentially the same process; the bot doesn't post full transcriptions, it just gives attempts that we can look over, reformat and correct. Some people do use it, but I don't for a few reasons.
First of all, code is actually often some of the worst work OCR does (section 3.2 in the FAQ). I've seen cases where the quality is so bad that you're basically just typing it from scratch anyway.
Secondly, because I'm already quite a fast typer, it doesn't save a huge amount of time.
Finally, typing from scratch is more engaging for me, personally. If proof-reading were all I was doing, I'd lose interest.
I think batch (windows' one) really is the ugliers one. Do you agree that we need a language for a command line shell? If yes tell me why bash is not the best candidate.
whe I agree that bash is definitely the better shell, I still think it's a bit ugly because they kept piling convinience features ontop of eachother, which just led to it becoming more and more complicated. I think a normal dynamically typed language like python, js, or tcl would be better.
Do you agree that we need a language for a command line shell?
yes
tell me why bash is not the best candidate
because there's so many different ways to do the same thing. It's not idiomatic. I need to google how to create an array every time I need to do it and I never remember.
I need to google how to create an array every time I need to do it and I never remember.
Me too, but I think that's because I only need to create that array only once and never use for the next few months and I'll forget by the time I need it.
Can you remember when to use single vs double brackets in bash? Does it even matter?
Do you remember if a semicolon is required or optional in a for loop/if statement?
These are things I don't remember off the top of my head and need to google every time. What's the point of the words "do" and "then" besides obfuscation and complicated BS?
Always use double brackets for safety. You can use single brackets if you're sticking with the POSIX operators (there's a lot of them), but you shouldn't. It matters because it's easier to make mistakes in single quotes. For example, if you forget to put quotes around a variable, double brackets will treat it as a single operand even if it's empty or has multiple words, while single brackets
Bonus: you can also use double parentheses for numeric operations, which gets you nice things like > and < instead of -gt and -lt.
Bonus: single brackets aren't necessarily a syntactic construct. The single bracket is essentially just the test builtin with the additional requirement of using a closing bracket as the last parameter. See also /bin/[.
Semicolons are very rarely required in Bash; you can just put the then/do on the next line instead.
Bonus: in zsh, you can sometimes leave the semicolon out even if you don't put the next word on the next line.
I remember that it caused me some pain back then that it took me a few hours to realize I have to put after the condition expression otherwise I was getting some weird error. However I don't remember in which case I needed it, I think i needed ; if I put them on a new line and it's not needed if I put it on the same line as the if keyword, but I'm just brute forcing right now lol.
Yeah the syntax is kinda hard to remember or not conventional to the stuff we used to I'd say. There definitely could be more optimal shell language designs, but right now bash is getting shipped with most of the linux distros, so I'd rather deal with syntax than satisfying dependencies for another shell.
9
u/dylwhich Nov 29 '22
is that gradle wrapper?
154
u/randamm Nov 29 '22
This is usually because the script is generated and targeting different or old versions of bash or sh, where precise semantics of things like $* might not be guaranteed.
56
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 29 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
47
u/tomushimano Nov 29 '22
Is that gradlew?
13
u/alban228 Nov 29 '22
gradlew moment
5
u/OpportunityIsHere Nov 29 '22
perfect
git add . && git commit -m “feat: masterpiece” && git push && git merge
Closes laptop
5
u/califloridan Nov 30 '22
+12 LoC for your next code review with Elon!!!
8
u/shizzy0 Nov 29 '22
All they needed was “$@“.
2
u/Leo-Hamza Nov 29 '22
Copilot moment
1
u/Ambitious_Ad8841 Nov 29 '22
Just back away slowly. If it attacks, stand your ground
1
u/carlton_sand Nov 30 '22
mr krabs laughing
1
u/Linux55_ Nov 30 '22
it looks like stairs
0
u/NeoLudditeIT Nov 29 '22
If only there were a way to avoid this /s
0
u/[deleted] Nov 29 '22
[deleted] — view deleted comment