Let's say I have a simple stupid script that removes files by ending, looking like this:
rm *.uvw *.xyz
The script, or
rm, to be precise, writes messages on stderr if it cannot find at least one file with the specified ending.
Now let's say the script is a bit bigger and does a bit more with a bit more file types and I'm not interested in which file types exist and which don't, but the complains about non-existent file types obstruct the rest of the output and error messages I am more interested in, so I want to filter the output:
rm *.uvw *.xyz 2>&1 | grep -v "No such file or directory"
This works fine for the most part, but it removes the message part of interactive dialogs, which for example ask, if a write-protected file should be deleted, so I get prompted without the according message.
I do not understand this behaviour and could not find any related information. Can someone explain this?