4 ms·
ChatGPT has been amazing for all kinds of programming-adjacent things, even in my line of work where I asked it for help modifying the config file for a selfhos
by generalizations 4y ago
ChatGPT has been amazing for all kinds of programming-adjacent things, even in my line of work where I asked it for help modifying the config file for a selfhosted gitlab instance.
> But [Bash] fucking sucks. Like, it’s truly awful to write [...]
As an aside, considering how basic the shell script actually was, I think this is a great example of being so intimidated by something that you don't actually try and use it - until you do, and discover it wasn't actually that bad. The hardest part was just discovering the incantations for interacting with Chrome - which was a fantastic demo of the power of ChatGPT.
- SpencerMLevitt 4y agothat's a great point - totally agree on just gettin over the hump of intimidation to try it, and chatgpt makes that hump trivial
- yamtaddle 4y agoBash isn't that bad... except there are 20 ways to do anything and 18 of them are wrong, but only 1% of online examples will use either of the two correct approaches and simply reading docs won't always clue you in about how the technique or syntax it's describing is actually subtly wrong and you should ~never use it.
- jakogut 4y agoI find integrating shellcheck into my text editor was one of the best things I've done for increasing my productivity when writing shell scripts.
- danielheath 4y agoYep - in the same way that you want govet, eslint, rubocop etc - but to a higher degree, because bash hides subtle bugs as soon as you use a variable without knowing the quoting rules.
- sureglymop 4y agoYes, i did the same! I also recommend following Stephane Chazelas on stackoverflow. The guy is a shell wizard who writes multiple quality answers a day. He's also the guy who found the "shellcheck" vuln some years ago. Learned a lot by reading the RSS feed of his SO profile every day.
- deleted 4y ago[deleted]
- alganet 4y agoBash _itself_ (or any other shell) is very small. You're talking about the ecosystem (shell + other command line utilities). Commands like awk, find, grep, sed, cut and so many others are not strictly part of the language. They're external tools commonly provided by the operating system or distribution. That's why there are so many inconsistencies between their options. Here are the very few commands that actually are part of any modern shell: cd, printf, test, read, command. The control structures (if/elif/fi, while/do/done, for/do/done, case/esac) are also part of the shell, so is declaring functions and fd redirection. Some shells might do more (bash itself has a handful of other builtins, dash has fewer, ksh has different ones). Stuff like find, mv, cp and dd are very uniform across implementations and often don't change much, but they are external tools nonetheless. Once you internalize this distinction, and start to see these external commands like npm packages, scripting gets a lot easier.
- Izkata 4y ago> Bash _itself_ (or any other shell) is very small. You're talking about the ecosystem (shell + other command line utilities). I'm not so sure. They mentioned syntax, and the single biggest issue among my co-workers who don't like bash is that they think ' and " work like they do in python or javascript.
- ungamedplayer 4y agoUser error.
- alganet 4y agoThey mentioned "20 ways of doing things", I'm replying to that complaint. Quoting is an issue if you don't understand the IFS and command expansion. It's an old fashioned style, but it is consistent and there's only one way of doing it (quoting every variable and subshell use). Think of shell variables as non first-class citizens, they can only be used interpolated within a string, like "$var". The shellcheck tool enforces this perspective, which makes ' and " behave very much like python or JS.
- 4y ago
- freddref 4y agoI've always been sheepish about this, but bash is my favorite programming environment! Not really because of any language features as such, more it's terseness and simplicity. Another big draw for me is bash's ubiquity. All of this makes bash the ultimate glue layer. That said, if a bash script goes longer than ten lines long I'll usually rewrite in python.
- naderkhalil 4y agoyeah absolutely. I think interacting with chrome and also parsing/iterating files were hard parts that ChatGPT breezed through.
- pizzalife 4y agoAlso, the specific argument format that chrome expects has nothing to do with Bash.
- forrestthewoods 4y ago> The hardest part was just discovering the incantations Right, that’s why Bash sucks. A more extreme version of this is APL. Bash isn’t APL bad. But it’s pretty bad!