Writing to standard error

Hi,

I want to redirect the standard output to standard error whenever an error occurs for ex

if [ a -eq 0 ]
then
echo right
else
echo wrong
fi

I want to redirect the wrong to stderror .Adding a line 1>&2 will do that or is additional code to be added.How can i verify whether the output is written to standard error?Help me.

Regards,
Padmini

jb>cat s3
echo right
echo wrong >&2
jb>sh s3
right
wrong

jb>sh s3 1>log.txt 2>elog.txt

jb>cat log.txt
right
jb>cat elog.txt
wrong
jb>

Thanks for the reply