Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

11–20 of 148 posts

Re: Using ChatGPT to make Bash palatable

#12

Earlier quoted context omitted.

I try to use it like this sometimes but then I realise I now have two problems. I have to debug my own code and its code.

it can usually debug itself if you give it an error message

Assuming the problem with the code causes an error message. That’s actually the easier case - the hard case is incorrect logic but syntactically ok.

Re: Using ChatGPT to make Bash palatable

#13

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…

that's a great point - totally agree on just gettin over the hump of intimidation to try it, and chatgpt makes that hump trivial

Re: Using ChatGPT to make Bash palatable

#14

Github Copilot can do this too.

Totally! I found ChatGPT to be more helpful in this use case since it outputted full code snippets instead of generating it line by line. The context was also extremely valuable in making iterations (like "make it work for mac")

Re: Using ChatGPT to make Bash palatable

#15
post #8

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

It has trained on countless programming tutorials out there, including bash tutorials for all kinds of things. Such tutorials often includes "create file -> ls to see file -> print content of file" etc, so GPT then takes those tutorials and creates grammatical rules how those words transform into each other. But if you start going outside of the realms of online tutorials it starts to falter quickly and then just prints nonsense.

Re: Using ChatGPT to make Bash palatable

#16

yeah, game changer. it's deprecated having to click on links for common use-cases and not only that, it's improved it by more than 10x. can't wait to see this technology evolve.

100%, also just looking up dev docs for frameworks. Something like "write a post API in Golang's Gin framework" instead of looking up what that syntax was again

Re: Using ChatGPT to make Bash palatable

#17
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/teaching.

Re: Using ChatGPT to make Bash palatable

#18
post #12

Earlier quoted context omitted.

it can usually debug itself if you give it an error message

Assuming the problem with the code causes an error message. That’s actually the easier case - the hard case is incorrect logic but syntactically ok.

It's surprisingly good at helping figure out what went wrong. Try asking it "something went wrong and I'm not sure what. What should we try next?"

Re: Using ChatGPT to make Bash palatable

#19
This is a great example of how someone with little programming knowledge could leverage an AI into building simple scripts.

Lately I've been encouraging my friends into trying just that.

If the poster would want, for example, to save all current tabs when switching context (going from dev to marketing, for example), this would quickly turn into a more involved debugging/prompting question.

Re: Using ChatGPT to make Bash palatable

#20

This is an awesome walkthrough and gets me thinking about all the other automation tasks I could get done with ChatGPT-driven bash scripts... can take this same approach to context switching for actual apps. For ex: "dev" branch can open up vscode, terminal windows, linear, server logs, etc, while "marketing" branch can open up slack, chrome (to email), twitter, notion, etc

ChatGPT has opened my eyes to how powerful Bash can be. Interesting idea about branching full workflows and not just the browser.
Post reply on HN