#regardless if that code came from stackoverflow or chatgpt.
Explore tagged Tumblr posts
sed-official · 1 month ago
Text
i saw this post and decided that i had some time spare, i could give AI another go. (link to post https://www.tumblr.com/dibelonious/778852078032404480/now-that-ai-made-troubleshooting-ridiculously. dont harass the poor old sod obviously.)
Tumblr media
i hear a lot of people irl at uni and some online say ai is great for coding, and so every couple months i try it out. sometimes with a very small project in a popular language (python or c, usually. though im forgiveful with c as everyone fucks up c.), sometimes with something simple (i.e. a couple lines tops with a naive approach if written idiomatically) but in a more unusual language with full documentation online. (like sed! yay!)
but every single time i come to the conclusion that even with being handheld chatgpt could not do what it was asked to do. even if someone tells it every issue in its outputs, itll remember for only one prompt. even if someone tells it the solution, itll find a new way to fuck it up.
below the cut is me trying to get chatgpt to make a working sed script that prints "meowwwwwwwwwwwwwwwww..." (long post warning)
(if anything reads weirdly, this was originally a reblog to the screenshotted post, then i decided to make it its own post. so that may be why.)
i cant remember the last time i ran into an issue that i couldnt fix in like ... 5 minutes. but knowing what chatgpt is like, any ask i give it will give me issues to troubleshoot. (yes this example is code, not linux proper. but its more of the same doing that.)
the other day i decided to write "meowwwwwwwwwwwwwwwwwwwwwwwwwwwww....." in many different languages, after seeing @brainfuck-official do it in BF. (link to post https://www.tumblr.com/brainfuck-official/773510105608192000) as is my blog, i asked it to do this in sed.
Tumblr media
great! this script doesnt work! it doesnt even come *close* to working, giving me plenty to try out chatgpt's troubleshooting skills! it also just doesnt make much sense. why the shebang but not making it executable? and why are the flags different (ones -f, ones -nf). also a counter? why though? thats not what im asking for? (you can see tags for a brief explanation on how to add a counter)
after telling it the script doesnt work (and why, something someone troubleshooting likely wont know) it just adds in a P. a command that prints a damn newline. but it lies about it printing a newline.
Tumblr media
(if you dont believe it prints a trailing newline and believe the AI instead, just try echo -n foo | sed -n 'P ; P')
anyways it alternated between no print statements and printing with newlines for the next ... 8 prompts, by which time i felt sorry for the poor bugger and told it to use e to print without a newline.
all the while it was trying to be more useful and add a count - making it print my string after n repeats instead of the infinite that i asked for. it was trying to subtract 1 with effectively s/[0-9]+/&-1/ which just appends the string "-1" to a number!
anyways, i tell it to use "the e command". there are three different versions of the e command in sed, and only one of them makes sense here. which did chatgpt use? none! it used the e regex modifier! which executes your pattern hold, then turns the output into the new pattern hold. and does not print anything.
ill just screenshot the last couple interactions minus only the useless exposition it adds to every response so you can see how stupid it is
Tumblr media Tumblr media Tumblr media Tumblr media
ignoring sed's requirement for an input this is equivalent to the python
Tumblr media
to be fair i never said there shouldnt be infinite meows, and this does have infinite Ws. but come the fuck on. this is clearly not whats being asked for.
#linux is best - yes. but learn to troubleshoot properly.#blindly copying code online without understanding it isnt troubleshooting.#regardless if that code came from stackoverflow or chatgpt.#anyways maybe it wouldve been better to write the equivalent in C with gotos and labels?#but at least everyone knows python#and i dont need to write c this way#also decided to see if it could find any info about me if i give it my name and county of origin#which is identifiable information but its outdated as ive changed my name (trans :3) and moved away.#anyways it thought i was from l*nd*n.#i told it where i was from (West Country. Very Much Not london.) and it thought i was a londoner. what in the hell.#yes if i said the name of most counties to an american online theyd probably think its in london.#but thats before they google the damn place! and this bot has access to the whole internet!#(for the yanks: it did the equivalent of calling an appalachian a californian)#(or at least i think thats close enough. im not really all that sure about what happens over the pond. and i like my ignorance here.)#wait the documentation tells you how to make a counter. at least twice.#IT COULD COPY CODE FROM THE INFO PAGES FOR THE COUNTER AND IT STILL GOT IT WRONG EVEN AFTER BEING TOLD WHY ITS WRONG#oh my god.#anyways in the docs they wanted to print the number. you can just hold n chars and remove one each loop#then break the loop when your hold is empty.#thats the easiest way ive found of looping n times (if you need the hold do this on a prepended line)#(not efficient but you can make it more efficient if you want. the docs explain how to! but its more effort and easy to fuck up soooooo...)#printing n ws though? just use e printf like it bloody demonstrates itself#no need to do inefficient shit in sed when someones written it in c for you.
0 notes