Core iTOps Tube

Wednesday, 16 May 2012

/dev/null not working as expected


I have a statement like this:

COMMAND="which java"
RUN_COMMAND=`eval "$COMMAND"` > /dev/null
echo "Output of the command:"$RUN_COMMAND

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?

No comments:

Post a Comment