3 ms·
IMO, that's not where the inscrutability comes from. Rather, it is things like many useful (and thus used) constructs being implemented with line noise like `"$
by sanderjd 3y ago
IMO, that's not where the inscrutability comes from. Rather, it is things like many useful (and thus used) constructs being implemented with line noise like `"$(foo)"`, `2>&1 &`, `${foo:-bar}`, etc., finicky control flow syntax, surprising defaults that can be changed within unclear scopes, etc.
- bayindirh 3y agoYou're right, but you can also expand these. If not syntactically, by adding temporary variables and comments around these complex parts. It's true that Bash and Perl has one of the most contractible syntax around, but it's not impossible to make it more understandable. However, these parts of codebases are considered "supportive" and treated as second class citizens, and never receives the same love core parts of the codebases enjoy. That's a big mistake IMO. When you make something more readable all around, hiding things becomes harder exponentially.
- im3w1l 3y agoI have seen people write bash scripts with a lot of love and attention trying really hard to pay attention to modern best practices and avoiding known pitfalls and using shellcheck. It still looked like shit imo. I challenge you to find a single easily readable >100 line bash script and link it here (I do think small scripts can be fine).
- bayindirh 3y agoWhile not completely up to my own standards, this is pretty neat and readable: https://rclone.org/install.sh https://rclone.org/install.sh I may add more if I have time today.
- im3w1l 3y agoMust say I'm pleasantly surprised.
- sanderjd 3y agoYep, my experience of this was at google, where I heard "gbash is actually pretty good!", so I learned that system well (because shell scripts are incredibly useful!), but still found the results unsatisfyingly inscrutable.