Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

141–148 of 148 posts

Re: Using ChatGPT to make Bash palatable

#141
post #107

Earlier quoted context omitted.

They 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 en…

To give a more solid example, they don't understand why npm test works and why they don't need npm "test"

That's just lazy. How that works is on any shell man page. If you fiddle with it a little bit you figure it out:

    set -- "foo"
    echo $#
    set -- foo
    echo $#
    set -- "foo bar"
    echo $#
    set -- foo bar
    echo $#
Of course, people just want their commands to run and not learn a whole new language. Then I come back to my initial point: the language itself is small and easy to remember once you internalize it, what makes it scary is the umbrella of different command line utilities that _seems_ to be a part of the language but it's not.

Re: Using ChatGPT to make Bash palatable

#142

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…

Has anyone tried to make ChatGPT output first order logic statements about it's input problem, then make implications using a solver, then feed the solution back to ChatGPT for usage ? Maybe this could solve the reasoning part. ChatGPT should perform well in translating prompts to statement and vice versa, it's just text to text.

People have asked it to solve LeetCode problems and solves then. Those people also suggest a minor modification to the problem that a novice programmer could do and it fails.

Re: Using ChatGPT to make Bash palatable

#143
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…

But wouldn’t Google with super powers produce correct answers to basic questions, though? I mean, really. It’s clear very helpful at surface things for which there is a large corpus of examples, to some extent. I don’t really know if it’s “good” or if it is just surprising.

Re: Using ChatGPT to make Bash palatable

#144
post #123
post #119

Earlier quoted context omitted.

this has nothing to do with quoting also='another way to pass variables to child scopes' sh -c "echo $also"

Neither of those are passing variables, those are setting environment variables. Bash (probably most shells?) mixes its variables with environment variables, and "export" is how you promote a bash variable to an environment variable. The inline version (GGP's [THE=tell the] version) sets the environment variable only for that one executable, while an exported one persists. Also I'm guessing you didn't test that, you…

They are both variables. I just wanted to show how it's different from export

no I'm on my mobile so I sure did not, should be sh -c 'echo "$var"'

Re: Using ChatGPT to make Bash palatable

#145
post #8

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

You can directly ask it whether it is capable of reasoning and it tells you it's not, and that it's just a language model that is not capable of reasoning or self improvement or something along those lines. Another example, ask it for a list of programming languages that it has been trained on. If it was capable of reasoning it would be able to trivially answer this, but since its a language model, and it just predic…

Well, this is exactly it. We are being told to believe that the end of knowledge work is nigh but yet this thesis is built on a bed of nonsense. It is just hand-wavy science fiction that even some academics with impressive pedigrees are promulgating. I think it is irresponsible as there is no sensible dialogue going on so you have students freaking out and will decide what not to study based on this and people making career decisions based on this misinformation.

Re: Using ChatGPT to make Bash palatable

#146
post #110
post #84

Earlier quoted context omitted.

In the current state, everything the AI knows is stuff that people have written on the internet. It doesn’t seem to come up with new insights or judgements on its own. If people stop writing, AI won’t learn anything new (unless you turn it into AlphaZero for $DEVTOPIC). ChatGPT certainly saves time, but it becomes useless roughly at the same point where I would remain stuck after exhausting what Google Search turns u…

One avenue that chatGPT has, and I'm not sure if it is being utilized at all yet, would be the ability to feed it the unimaginably huge body of information locked behind copyrighted textbooks, books, academic papers and other pay walled information. Imagine the knowledge that could be accessed by feeding all that information into an ai engine like chat gpt. Presumably, it would not break copyright rules anymore than…

Its not stealing your writings its sharing the conclusion in its own words like you can legally do a book review.

It wont be just like search as we burn all the books (websites) on the www. Each website needs a human to pay for it and to lure at least some traffic to it.

This preservation after death has its downsides too. It will turn into the steroids v of stack overflow outdated answers.

It will be (or already is) brilliant at combining things writing humanly readable code in your favorite language and bake the same in lower ones that are perhaps oddly stable.

So I guess we will finally be able to do away with all popular languages and use them for pseudocode only⸮

Re: Using ChatGPT to make Bash palatable

#147
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…

The end of privately owned search engines is number one on my wishlist, I’d so love to see that happen.

Re: Using ChatGPT to make Bash palatable

#148

Earlier quoted context omitted.

I had to try PowerShell for a project. It is soooo much better that bash. Passing typed objects instead of only text, Typed functions, and the ability to use C# types/functions inline !

Now we only need it to start up at least 100 times faster than it does currently, and be available out of the box absolutely everywhere. I have no use for it for these reasons alone. $ hyperfine -N 'bash -c ""' 'dash -c ""' 'pwsh -c ""' Benchmark 1: bash -c "" Time (mean ± σ): 2.2 ms ± 0.1 ms [User: 1.8 ms, System: 0.4 ms] Range (min … max): 2.1 ms … 2.6 ms 1214 runs Benchmark 2: dash -c "" Time (mean ± σ): 0.6 ms ±…

And have core cmdlet features available in all supported versions.

For example, `Invoke-WebRequest` generates an error when you get a response by default with a 5xx status code, even if there's data in the response body. The switch to turn that off (`-SkipHttpErrorCheck`) wasn't added until ~7.2, so to support older Windows installations I don't have control over, I have to write it targeting the older version.

You don't find this out via the online documentation (unless you explicitly diff the call signature); only when it fails running on that Windows Server 2016 VM do you find out that, oh, it's only a supported parameter in newer versions of PowerShell.

And that's just a single example.

Did you make a typo when referencing a variable? Ha, let's silently initialize it to null without saying anything. Want to turn on strict mode to catch stuff like that? Better not put that line before the script-level parameter block, because fuck you. Great, that's sorted... ugh, now some type in some random function call doesn't explicitly match so the silent casting we were doing for you is now an error! How was the silent cast being done before? Fuck you for asking, we're never telling. Did you want to put some log / print statements in your functions? Have fun finding out why the function return value is suddenly an array!

As a shell scripting language for short, personal things, it's great. But for building anything bigger? Give me Python or C# or TypeScript or anything with better tooling around it.

Post reply on HN