Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

71–80 of 148 posts

Re: Using ChatGPT to make Bash palatable

#72

Earlier quoted context omitted.

Nope. macOS aliases suck. It’s a binary unmodifiable file that can only point to a file, it can’t specify anything additional.

Is there a reason you can't add a script to your path and alias that? #!/usr/bin/env bash my-command --flag --another-flag $@

As far as I know, you can’t get an executable script like that to act like an app that’s launchable when double clicked from Finder or clicked the Dock. Even though it’s executable.

Re: Using ChatGPT to make Bash palatable

#73
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.

Yes, 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.

Re: Using ChatGPT to make Bash palatable

#74
post #72

Earlier quoted context omitted.

Is there a reason you can't add a script to your path and alias that? #!/usr/bin/env bash my-command --flag --another-flag $@

As far as I know, you can’t get an executable script like that to act like an app that’s launchable when double clicked from Finder or clicked the Dock. Even though it’s executable.

I just tried it, seems to work! Make your script with custom options, mark it as executable, make an alias for it within finder, and drag that into your dock.

Re: Using ChatGPT to make Bash palatable

#75
Wow, yea, I've have the exact same experience with bash.

"im using mac, not linux" is an often prompt I need to use, but otherwise this type of flow works great for simple bash functions.

For more advanced scripts, prompting & careful flow are important, but I've done some pretty awesome things. Today, ChatGPT helped me create a bash script to create a flat structure of large tars from an nTiB dataset directory by aggregating multiple sub-datasets & their files into the desired tar file size. Eg. "need single tar files of all the data in that folder/subfolder, every tar file must be 50GB, most files range from 4MB-1GB. So, need to aggregate them"

Re: Using ChatGPT to make Bash palatable

#76

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.

Thanks for the idea! I just found a Streamdeck from a past Cyber Monday when I was cleaning out my closet.

Re: Using ChatGPT to make Bash palatable

#77
post #15

Earlier quoted context omitted.

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

To add to this, each token is generated by going through its network once. So there's no way computationally for it to do any reasoning or follow an algorithm. That said though it's impressive how much its able to accomplish without any procedural reasoning.

I've taken to saying that the ~emergent behavior here underscores what an incredible bootstrap written language is.

I think of it as a savant-esque capability. A glimpse of what we might be like if some slices of our language/memory faculties were turned up to 1111 while others are completely absent.

Re: Using ChatGPT to make Bash palatable

#79
post #59

Am I the only who think this is incredible!? If you would've told me a year ago when we would have an ai that can code based on normal human language prompts, I would've said maybe in 2025 or 2026, but its 2022 and it already exists! Man, if this what we have now, imagine what we will have in 2025 or 2030! I just hope this doesn't end up killing search engines and personal blogs, since no one needs to search for anyt…

This is a tool that I think openai originally made and seems to give you a probability that a sample block of text was or was not generated by openai. I pasted some of my own writing in there and said definitely not AI-generated. At this point, I don't know if I should be insulted by that or not. ;D

https://huggingface.co/openai-detector

Re: Using ChatGPT to make Bash palatable

#80
post #60

Earlier quoted context omitted.

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

Which is why prompt engineering is an emerging domain: You will be given a series of tasks. (1) Complete a task by finishing the simple code block. (2) If a task in the series seems flawed, provide a warning. A task is flawed if I make wrong assumptions about how I think code works. Task 1: Complete this simple code example. Bitwise XOR swap trick: ``` int a = 5; int b = 10; --------------------- // GPT provides simp…

This seems very fragile. I tried your initial prompt, asked for "Give an example of the bitwise and swap trick" and got the XOR swap trick. I replied " you used sed xor, I wanted to use bitwise and", and it went straight back to printing incorrect code.
Post reply on HN