Asking the wrong question wastes both the asker and the answer's time. By all means be kind, but if you fail to take the opportunity to remind someone to be wary of this general problem you are doing both them and yourself a disservice.
Q: How can I echo the last three characters in a filename?
A: What is it you're trying to achieve by doing Y? What's the context? You can probably do it this way ... , but let's see if it's a good fit for the problem you're trying to solve.
This doesn't suggest that the questioner did something wrong, but still helps them learn to provide background details when asking questions.
If you ask too broad a question you’re likely to be ignored, imo.
If I saw the original examples happen in the wild, I'd understand the person answering the question to be the problem.
People are there to voluntarily give help. They also get loads of really stupid questions and venting does help with keeping them providing help.
If your goal is to reduce help, then be my quest.
Ha, imagine hearing this about volunteers at a hospice. SO boards are infinitely less important, but volunteers shouldn't be losing their calm at the same people they're helping
If you must vent, vent privately to a friend. If you can't help but vent back to the person asking the question, then please stop answering questions, because you aren't helping.
See how it plays out.
Very few people have knowledge that is so rare and difficult to obtain that others should endure discouragement (or plain unpleasantness) in order to receive the benefit of their help. And, in my experience, the people who do have that sort of specialized knowledge are often some of the most helpful.
Here's how that conversation should have gone:
---
Q: How can I echo the last three characters in a filename?
A: If they're in a variable: echo ${foo: -3}
A: However, if what you really want is to get the file extension, it's probably better to handle extensions of any length. Try this instead: ${foo##*.}
A: That expression says to find the longest prefix of `foo` that matches the given glob pattern, and remove it.
Q: Oh wow! That is actually what I wanted, but it hadn't occurred to me that such powerful pattern-matching would be built into the shell. I already had a solution involving piping through sed, but it was pretty slow and ugly. I noticed that all the files I'm operating on have three-letter extensions and I figured there'd be an easier way to take a slice of a string, since that's a common thing to have built-in. But your answer is the best of both worlds. TIL!
---
There's really no need to admonish the questioner for starting with the wrong question. That won't help. It will only make them afraid to ask questions at all.