Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

31–40 of 148 posts

Re: Using ChatGPT to make Bash palatable

#32

I just bought a Streamdeck ( https://www.amazon.com/Elgato-Stream-Deck-Controller-customi... ) for Cybermonday and attached bash scripts similar to those mentioned by the author to buttons next to my keyboard. It is delightful.

What action type do you use for your script? "Open"?

Re: Using ChatGPT to make Bash palatable

#33

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…

Bash 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.

I find integrating shellcheck into my text editor was one of the best things I've done for increasing my productivity when writing shell scripts.

Re: Using ChatGPT to make Bash palatable

#34
I've been using it more and more at work, and it's already saved me hours by generating bash commands and simple scripts/servers that I would otherwise have to search for on Google and adjust to my specific use case from multiple sources. Thanks to this tool, I have more time to focus on difficult and business-related problems. If they start charging for it, I will definitely become a paying customer. This is an excellent tool that is making me more productive, and I was a big skeptic about how LLMs work internally. Remove hallucination problem, add annotations with links to sources and this is how Google will look like in a few years. IMO this is how future of knowledge search will look like on the internet.

Re: Using ChatGPT to make Bash palatable

#35

I just bought a Streamdeck ( https://www.amazon.com/Elgato-Stream-Deck-Controller-customi... ) for Cybermonday and attached bash scripts similar to those mentioned by the author to buttons next to my keyboard. It is delightful.

What action type do you use for your script? "Open"?

Yeah open works, you can also create a multiaction to mix-and-match with other actions or scripts in between.

Re: Using ChatGPT to make Bash palatable

#36
post #8

I don't understand how people can look at this and still claim that it's not doing any "actual reasoning".

Here is an example of where I think it is doing "no reasoning".

I ask it for the XOR swap trick and I get:

    int a = 5;
    int b = 10;

    a = a ^ b;
    b = a ^ b;
    a = a ^ b;

    // After the swap, a = 10 and b = 5
I ask for the bitwise OR swap trick and I get:

    int x = 5;
    int y = 10;

    x = x | y;
    y = x | y;
    x = x | y;

    // After the swap, x = 10 and y = 5
When asked for something which is invalid, but close to something it knows, it tends to produce stuff like this -- pattern matching it's best guess.

Re: Using ChatGPT to make Bash palatable

#37

I find it interesting how much harder it is to grok bash/sh/zsh than other languages I’ve learned. Off the top of my head it may be tooling like the lack of linting, or maybe it’s just experience as I avoid complexity like the plague when writing bash which sounds like a self fulfilling feedback loop. Gpt does seem to unblock this mental burden a bit which has me excited for its potential when it comes to education/t…

Something about the quoting / unquoting can get really difficult to reason about. I'm rarely exactly sure how the language constructs work, even the for loop and the if statement. The syntax is complex compared to most other languages, and subtle differences can give totally different results.

  PICK = can you
  THE=tell the
  RIGHT=difference\ between
  WHAY="all of"
  TODO='these versions?'

Re: Using ChatGPT to make Bash palatable

#39
post #33

Earlier quoted context omitted.

Bash 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.

I find integrating shellcheck into my text editor was one of the best things I've done for increasing my productivity when writing shell scripts.

Yep - 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.

Re: Using ChatGPT to make Bash palatable

#40
post #29
post #8

I don't understand how people can look at this and still claim that it's not doing any "actual reasoning".

Chat GPT is simply amazing, it feels like Google with super powers. I think it can boost productivity by a considerable amount. It makes a perfect peer programmer, giving you sample code with first class comments explaining the generated code, sometimes with minor errors to make it compile. You can even ask it to explain some specific part of the code. It's also like having a secretary or an assistant available 24/7…

You've… really got the right answers from it? I've only ever asked it a couple of really basic (non-trick! straightforward!) questions about how to accomplish tasks by programming, but it bullshitted me some very plausible nonsense. Once bitten, twice shy. If it were capable of saying "I can't answer that question" reliably (which I've spent some time trying and failing to make it do, in general), it might actually be useful.
Post reply on HN