Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

41–50 of 148 posts

Re: Using ChatGPT to make Bash palatable

#41

I was just commenting to a friend how annoying it is that macOS aliases can't add flags to executables like you can easily do in Windows shortcuts since, what? Windows 95? If you want to launch Chrome with flags through your dock/UI you have to compile an AppleScript to an .app. It's crazy.

I don't use osx but surely you can create aliases just like in Linux and BSD?

Re: Using ChatGPT to make Bash palatable

#42

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…

Also, the specific argument format that chrome expects has nothing to do with Bash.

Re: Using ChatGPT to make Bash palatable

#43

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?'

yes

Re: Using ChatGPT to make Bash palatable

#44

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…

> 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!

Re: Using ChatGPT to make Bash palatable

#45
Just today I used ChatGPT to help me speed up writing somewhat trivial C Code for a project in an embedded systems class.

Prompt: "Generate a tiny PID controller with only a Proportional factor written in C. That takes a rotational input from -360 to 360 degrees. The setpoint in degrees. And returns a motor speed in the range of -255 to 255."

=> Produced a compiling correct result.

Later I wanted to know how to communicate between my kernel module and user space program: Prompt: "How do I get a value via character device from my kernel module into my user space c programm?" gave a bunch of answers and digging deeper with Prompt: "Could you provide me with an example of the user space program" gave a compiling and correct answer again.

I could have written all of that myself while spending a good amount researching on google. But this way I felt less frustrated and was definitively a lot quicker.

Not the solution for everything but maybe for a C beginner where research can take a long time and often leads to more confusion than anything else. Now the question is if that confusion is critical in the learning process. And if so how critical and at what stages of the experience spectrum the most?

Re: Using ChatGPT to make Bash palatable

#46
post #29

Earlier quoted context omitted.

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 b…

It happened to me once, it generates a plausible answer when it doesn't know (tried to generate a Nix script with Erlang). But I have used it to generate examples code in Haskell, and it was quite good, probably because Haskell libraries have excellent online documentation. It's much faster than reading the doc of the library.

Re: Using ChatGPT to make Bash palatable

#47
post #8

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

"actual reasoning" doesn't mean anything concrete, until you define what you are talking about it can't be the basis of a question you can meaningfully answer.

Re: Using ChatGPT to make Bash palatable

#48

Just today I used ChatGPT to help me speed up writing somewhat trivial C Code for a project in an embedded systems class. Prompt: "Generate a tiny PID controller with only a Proportional factor written in C. That takes a rotational input from -360 to 360 degrees. The setpoint in degrees. And returns a motor speed in the range of -255 to 255." => Produced a compiling correct result. Later I wanted to know how to commu…

I guess the main concern with its use as a learning tool is what happens if it's wrong? It might be helpful for boilerplate when you already know what you want, but if you don't even know that it'll blow up in your face when it doesn't give you something workable.

Still, seems like a viable assistant so long as you have an understanding of what you're working with.

Re: Using ChatGPT to make Bash palatable

#49

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.

I've done a similar thing on Windows and Powershell (via Open). Only limitation is it still spawn a terminal window even if briefly (enough to mess with focus however).

powershell -WindowStyle Hidden -ExecutionPolicy Bypass -Command "& { // Command(s) }"

In particular I use it with this Powershell Script:

https://stackoverflow.com/questions/21355891/change-audio-le...

via e.g.:

"& { C:\[Path To Script]\SetVolume.ps1; [audio]::Volume = 0.4 }"

For 40% and so on.

Re: Using ChatGPT to make Bash palatable

#50

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.

This is a neat product! What kinds of scripts do you have it set up to run?
Post reply on HN