Here if java doesn't exist in the system it throws some output like
no java in (/usr/local/bin:/usr/bin:)
And I don't want this to be on the console.
So, even after redirecting the output to /dev/null it's still sending the output to the console.
Any idea?
Sujoy Choudhury wrote:
So, even after redirecting the output to /dev/null it's still sending the output to the console.
Unix (Linux) doesn't have a "the output". It has 2 outputs: stdout and stderr. The constructs ">xxxx" and "1>xxxx" redirect stdout to "xxxx", but do not affect stderr. The construct "2>xxxx> redirects stderr to "xxxx" but does not affect stdout. The construct ">& xxxx" redirects both stdout and stderr to "xxxx".
Your problem was that the output was being channelled to stderr when you thought it would be going to stdout.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.