r/linuxadmin • u/Business-Quiet-5805 • 5d ago
Can AI actually write production-ready scripts end-to-end without human intervention?
/r/linuxquestions/comments/1x2lto3/can_ai_actually_write_productionready_scripts/1
u/MartinMystikJonas 5d ago
It can but before deploying to prod always review it (like you would surely do with scipts written by humans too 😉 right?)
1
u/asmiggs 5d ago
I'm currently doing a migration of some Windows servers to the cloud, since I'm a Linux/UNIX admin I don't have the time to learn Powershell to the complexity required, I'm having Claude and Chat gpt pair program their way through all the scripts.
We have the luxury of testing and it seems to work well so far.
I do think the code is pretty hard to read but we'll move them to Linux soon enough, and I'll pay for a bot to do the Powershell until then.
1
u/Adept_Percentage6893 5d ago edited 5d ago
I do think the code is pretty hard to read but we'll move them to Linux soon enough, and I'll pay for a bot to do the Powershell until then.
You might think a particular language is hard to read but there's often enough transferable skills to check the AI's output. For instance, I've only done basic PS scripting myself and it's been close to a decade but I can read this pretty well even though it would have taken a lot of effort for me to write something like that. It takes me about a minute to read and understand what it does but it might have taken me close to 30-60 minutes to actually re-learn enough PowerShell to produce it.
But I think the OP is more interested in whether or not you can just trust the AI's output. You might not feel like you're contributing much by being the human in the loop but the fact is that you are almost certainly contributing a lot to the process.
1
u/whetu 5d ago
End to end, by default? No.
If you understand your particular scripting language well, you can build guidelines for your AI of choice that will get it a lot closer i.e. not production ready but at least review ready.
But you really have to have that knowledge first, and you should still take the approach of "if I don't understand what the AI has written, then it doesn't get a pass until I understand it".
That's still not end-to-end. But at the very least, it can be significant productivity enhancement.
I think a lot of people who rely on AI are completely ignorant to the fact that they can say to that same AI "please explain lines 59-69" or even "I don't think you're right with your approach in funcname(), I think it should be like this: xyz". If you're using AI, you should use it more like a pair-programmer than a crux.
1
u/Faye-Vozora 4d ago
For small stuff yeah, it'll get you something that runs. The problem is you can't tell when it's wrong, like a rm with an unquoted variable or a cron job that fails silently. If you're a non-coder, run everything on a throwaway VM first, ask it to explain each line, and don't give it anything that deletes or touches prod until someone who reads bash looks at it.
0
u/whamra 5d ago
It certainly can. But quality is questionable.
What you think is something described in 5 sentences can actually be done in so many different ways, and the AI will choose one of those ways that might be what you want or might not. You end up having to reexplain things.
If I'm prompting an AI to build a script for me, it's usually because I already have the design in mind but I know it will involve too much repetition, so my prompts detail every bit of the script, and a 200 line script is sometimes described with 30 lines of a prompt, detailing every function and bit I want.
-1
u/Adept_Percentage6893 5d ago
Can they? Sure. Will they? No idea and unless you have a human in the loop you won't know when the AI has done one or the other.
Can a non-coder create a Bash automation script using just AI prompts?
You can but AI isn't reliable enough to where you should use it for real stuff if you don't have an understanding of what it's doing. For instance, I write a lot of markdown and YAML for my job. I can read it about 2-3x's as fast as I can write it. So I can ask the AI to write three YAML documents and then give me a two sentence summary of what is being done for me to copy/paste into the markdown file.
Now there's nothing wrong with that approach as long as I'm actually reading what the AI is doing. Oftentimes I find myself editing the natural language more than code, oddly enough. Going back to the example, it will often render the YAML correctly (or at most just incomplete in some way) but then when it goes to summarize that is somehow the thing it ends up doing slightly wrong. Where it will claim the YAML is doing something and that description is only 80-90% correct so I have to revise it.
If you think it's going to do your IT work for you, you're wrong. It's still something that extends existing expertise or helps you learn more about technical subjects. It's not reliable enough to just trust the output it gives you without checking, and you have to know how to check the output.
8
u/Mr_Enemabag-Jones 5d ago
Depends on how good you are at prompting. But it is absolutely capable of writing solid scripts.
Without human intervention? I would NEVER trust a script written with AI without a full review and testing.
EVER.