Hi,
Maybe redirecting the output from the command to eliminate the warning isn't what is needed. Maybe you need to figure out why the warning is coming out and see if you can eliminate it from your script.
For example, if command is something like.....
ls -l *.q | grep joke
( poor example but illustrates point)
and the LS would report 'No Match' which comes out through STDERR. You can correct this by also redirecting STDERR to the GREP which will throw it away because it doesn't match the grep pattern.
ls -l *.c |& grep joke
Adding to the posts about
Most UNIX's allow you to specify all output goes to the bit bucket. ( /dev/null )
command ... >&! /dev/null
> means redirect stdout
& means redirect Stderr
! means delete the file if it already exists.
There is no way just to redirect STDERR, so if you want the stdout to come out to the user but not the stderr you need to do something like....
( command > /tmp/out.$$ ) >&! /dev/null
cat /tmp/out.$$
rm -f /tmp/out.$$
This will redirect stdout to the /tmp/out.$$ file and then display it to the user and the stderr goes to the bit bucket.
hope this helps.