Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

It's been a long time

by stevieb (Canon)
on Apr 08, 2026 at 09:01 UTC ( [id://11167501]=perlquestion: print w/replies, xml ) Need Help??

stevieb has asked for the wisdom of the Perl Monks concerning the following question:

Been a lurker since ~2k and an active member since ~2k9. Threw a question to "AI" the other day to write a script to safely allow me to update an iptables chain that I need to implement remotely. The result is below. My question for the monks isn't a question. It's a request from an old timer to see if there are any newcomers who can rewrite this script in Perl, properly.

#!/bin/sh # apply-new-iptables.sh OLD=/root/iptables-old.rules NEW=/root/iptables-new.rules # backup current iptables-save > "$OLD" # apply new rules iptables-restore < "$NEW" # start rollback timer: restore OLD after 60s if not canceled ( sleep 60 && iptables-restore < "$OLD" ) & ROLLBACK_PID=$! echo $ROLLBACK_PID > /tmp/iptables-rollback.pid echo "New rules applied. To keep them, run: kill $(cat /tmp/iptables-r +ollback.pid) && rm /tmp/iptables-rollback.pid"

Hint: there is at least one hugely fundamental issue that AI hallucinated.

-stevieb

Update: Hablo español si prefieres.

Replies are listed 'Best First'.
Re: It's been a long time
by marto (Cardinal) on Apr 08, 2026 at 11:22 UTC

    The 'task' of rewriting/correcting AI Slop isn't particularly engaging, even for a newcomer I'd suspect.

Re: It's been a long time
by LanX (Saint) on Apr 08, 2026 at 10:33 UTC
    > Update: Hablo español si prefieres.

    ¿Por qué no le pides a la IA que lo traduzca a Perl? :-)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

Re: It's been a long time
by Anonymous Monk on Apr 08, 2026 at 20:51 UTC
    Lazy old git says what?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11167501]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2026-04-16 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.