Afficher un message
Vieux 13/03/2008, 17h15   #2
Teni
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: One file for "stout+sterror" and another for "sterror"; it'spossible?

On 13 Bøe, 15:13, luciosan <lucio...@gmail.com> wrote:
> Hi
>
> How can I redirect stout and sterror in a file and only sterror
> inanother file at the same time?
>
> For example, If I run the script:
> /script.sh >> log.txt 2>&1
>
> It will write in "log.txt" stout and sterror.
>
> But, If I want write stout and sterror in "log.txt" and at the
> sametime sterror in "error.log", it's possible?
>
> Thank you.
>
> --
> I'm using an evaluation license of nemo since 203 days.
> You should really try it!http://www.malcom-mac.com/nemo


Well, this is not a good solution, but it is a solution of your
problem I think...

./script.sh 2>&1 >log.txt | ./two_files_logger "log.txt" "error.log"

where two_files_logger is script like this:

#!/bin/bash
while read line ; do
echo $line >> $1
echo $line >> $2
done


I am pretty sure that there are many better, faster and "all-in-one-
script" solutions but that is what i would do...
  Réponse avec citation
 
Page generated in 0,56994 seconds with 9 queries