
07-10-2008
|
|
Registered User
|
|
|
Join Date: Jul 2008
Posts: 1
|
|
|
Adding custom mesg. when redirecting "exec 2>stderr.err" ?
Doubt regarding using "exec" command to redirect the STDERR to a file. e.g I did it this way.
mystage.sh
#!/bin/sh exec 2>stage.err
....
....
cat stage.err
mv: cannot move `/root/stage' to a subdirectory of itself, `/root/stage_old/stage'
ls: *.zDB: No such file or directory
................
Now I want to add some timestamp details and some line indetations for this error log along with the redirection.
How should I do that ? Is there any method for that ?
Can you help me out. I want the error file to be as below
cat stage.err
Timestamp :30-06-08-01:39:10
-----------------------------------------------------------------------------------------------------------------
mv: cannot move `/root/stage' to a subdirectory of itself, `/root/stage_old/stage'
-----------------------------------------------------------------------------------------------------------------
Timestamp :30-06-08-01:39:12
-----------------------------------------------------------------------------------------------------------------
ls: *.DB: No such file or directory
-----------------------------------------------------------------------------------------------------------------
Kindly help me in this regard !!!
Thanks
Shankar
|