Display Console errors in Red color

I browsed the forums but i couldn't find the best answer.so,i'm posting here again..
I have a parent bash script which calls another child script and the child script is used to deploy the tar file using weblogic deployer.
The script is used to display the output on the console and sent to a log file as well.
My problem is how can i display any error message in the output in a red color on the console?
It would be great if the errors in the log are also shown in red color.The errors could be from the weblogic deployer or from the scripts.

we use this for deploying the war.

${JAVA_PATH}/java -classpath ${WEBLOGIC_HOME}/server/lib/weblogic.jar weblogic.Deployer 
-adminurl ${WEBLOGIC_ABC_ADMIN_URL} -user ${WEBLOGIC_USERNAME} -password
 $WEBLOGIC_PASSWORD -deploy -targets ${CLUSTER} -name ${RESOURCE_WEB_CONTEXT}
 -upload $WORK_DIR/artifacts/webapp/components/${CONTEXT}-1.0.0-c.war

Appreciate your help in advance.

Thanks
-Ramesh

try this ..

$ cat filename
#!/bin/bash
pw > script_output 2>err_log
## pw is the not working command to capture o/p in error logfile
## In place of pw, use your command to run
echo -e '\e[0;31m'; cat err_log ; echo -e '\e[0;00m'
$
$ bash filename
j: pw: command not found
$

---------- Post updated at 03:01 PM ---------- Previous update was at 02:57 PM ----------

for more info abt shell colorings ..
Using colors in Shell Script

Thanks for the reply.
The solution i'm expecting is when i run the build script all the log statement will be logged to a single log.i don't want a separate log file for errors as that script will be executed by other persons not familiar with it at all.So just wanted to show the Exceptions/errors on the console in red colour as and when they occur while script executes.

Thanks

How is the console supposed to tell the difference, then?

That's the reason if the exceptions/error are shown in red colour on the console then the person executing the script understands that there is something wrong with build and deployment.
one more thing to note is that we output statements to the console as well as to the logs using "tee" command.
eg:
#$JAVA_HOME/java HelloWorldApp 2>&1 | tee -a Hello.log

Hope i conveyed you the pupose.

Thanks
-Ramesh

I'm not asking why you want them red.

I'm asking how you expect anything to tell the difference between errors and non-errors after you dump the error stream back into stdout with 2>&1. By doing that you lose track of which is which. And since they only appear on the screen after you've done that, it's going to be difficult to separate them again. You really should process them separately.

Trying to build something but it's going to be ugly.

---------- Post updated at 02:54 PM ---------- Previous update was at 02:09 PM ----------

Don't say I didn't warn you.

#!/bin/sh

trap "rm -f fifo" EXIT

mkfifo fifo

exec 5>logfile

# Run a loop in the background that reads stderr data from fifo,
# prints to terminal and prints to logfile
( while read LINE
  do
        printf "\033[1;31m%s\033[0m\n" "$LINE" >&2
        echo "$LINE"
  done <fifo >&5 ) &

# The first () command is just a substitute for your command
# which prints to stderr and stdout.
# We redirect its stderr into the fifo, where the background
# loop will read it.
( echo asdf >&2 ; echo qwerty ) 2>fifo | while read LINE
do
        # Print to the logfile
        echo "$LINE" >&5
        # print to the screen
        echo "$LINE"
done
# close the logfile
exec 5>&-

rm -f fifo

# wait for the background loop to quit
wait

Also, because of the extra processing loop involved in coloring the red text, the order you get in the file isn't guaranteed to be the same as you get in the terminal.