Live data from Hacker News

Show HN: Get answers for shell commands from GPT3 from your terminal

github.com

51–60 of 97 posts

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#51
post #47

Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…

lsof is available on Mac's by default, ss is not, so significantly smaller depends on your platform I guess. I believe ss is not available for Mac at all, where as lsof is widely available.

Well that is one of the problems when suggesting shell snippets. There are many similar ways to do the same thing¹ but most have some caveats or work on one system but not the other. And when asking the AI there might be not enough context to provide a good answer.

In this case the AI answer might be somewhat better for Mac. On Linux I have more often manually installed lsof than ss (iproute2). Maybe Mac provides the similar command netstat which is yet another tool to check ports

  netstat -nltp | grep -P ':8000\b'
Regarding available tools. Another very common Bash question is how to get the directory the executed script is located. A common answer involves `readlink -f` which (as far as I know) does not work on Mac (without extra steps).

¹ How to get current users name. Maybe whoami or id -un or logname or echo $USER or who -m or who am i (learnt this last one just today; apparently works with any combination of two arguments after 'who')

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#52

Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…

Does it matter if lsof is slower than ss? Somebody asking this to the AI is going to run it once, maybe twice. What's an extra second?

The answer doesn't have to be perfect, it just as to be good enough.

I could see this tool being incredibly handy for working with tar

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#53

Serious question. Why npm? I mean it's a command line tool; why buy in to the JavaScript ecosystem?

I'm a Frontend dev that's why I used JS but I can also publish to brew or as a single binary as the framework that I used (oclif) allows it. I was too lazy to publish it though. The code is open-sourced please feel free to raise a PR. https://github.com/abhagsain/ai-cli

Fair enough.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#54

Earlier quoted context omitted.

It's not a real programming language tho

Yeah! REAL programmers program only in the REAL programming languages like ${MY_FAVORITE_LANG}. Bash? More like - Bah!.

It's not a real programming language in the same way Brainfuck isn't a real programming language, because it makes life too hard.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#55
post #38

Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it) The example in the project readme is imo already a bad example. $ ai ask "Check process running on port" Answer Command i…

Another good example is asking: `ai ask "how to delete a file safely in linux"` > Command is `shred -u /path/to/file` A bit of a mix up between safely/securely

Safe is an ambiguous word!

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#57
ORT (Only Read Title, sorry) What I'm hearing is "put a non-deterministic black box between you and the man command."

Nah.

I recommend a stiff dose of Mickens: "Why Do Keynote Speakers..." https://www.youtube.com/watch?v=ajGX7odA87k ) and a good lie down.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#58

Earlier quoted context omitted.

Yeah! REAL programmers program only in the REAL programming languages like ${MY_FAVORITE_LANG}. Bash? More like - Bah!.

It's not a real programming language in the same way Brainfuck isn't a real programming language, because it makes life too hard .

So does Java, yet it is still considered a real programming language...

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#59
post #38

Earlier quoted context omitted.

Another good example is asking: `ai ask "how to delete a file safely in linux"` > Command is `shred -u /path/to/file` A bit of a mix up between safely/securely

Safe is an ambiguous word!

Perhaps the next most important feature of AI will be the ability to ask follow up / clarifying questions.

Re: Show HN: Get answers for shell commands from GPT3 from your terminal

#60

Earlier quoted context omitted.

It's not a real programming language in the same way Brainfuck isn't a real programming language, because it makes life too hard .

So does Java, yet it is still considered a real programming language...

I always have to share this video on threads like these: https://youtu.be/kdMG40wUCm4. Maybe you’ve seen it - interview with a senior Java developer in 2022.
Post reply on HN