I am currently writing a script that must, among other things, kill some processes.
I used the kill method and it works perfectly, except that, when I launch my script, some unwanted messages are print in the console saying for each of the processes that they have been "terminated".
I don't know how to get rid of these messages, so I would be grateful to anyone who can help me.
I would like these messages not to print inside the console, for they can be misleading. If I understand it correctly, those are error messages printed in the stderr stream.
Is there a way I can prevent these logs to print in the console ?
I have found on this site three issues that seem identical to mine, and proposed three differents solutions:
kill -9 $pid &> /dev/null
exec 3>&2 exec 2> /dev/null kill $pid &> /dev/null exec 2>&3 exec 3>&-
kill $pid
wait $pid 2>/dev/null
But sadly none of these solutions change the behavior on my script (I always have "Terminated" messages). Does anyone have any other ideas? I am relatively new to Linux and does not master the redirection of outputs yet, so maybe I am forgetting something really obvious?
A huge thanks to anybody who will try to help!