Artificial intelligent assistant

How can I redirect the same message to both stdoud and stderr (without temporary object) It is easy to redirect stdout or stderr to the same output (file or one of the 2 std output) with a `1>&1`,`>&2` and/or `>file`. Is there a way to send the same output to both the std output in KSH (like | tee File but with &2 as file) ? I try to have the stream to stdout AND on stderr at the same time (duplicate the output, one on each channel) but without using temporary object (variable or file) I use a temporary variable but try to avoid this Tempo="$( #all my code with output to stdout and stderr )" echo "${Tempo}" echo "${Tempo}" >&2 Question asked on StackOverflow with suggestion to ask it here

If your system doesn't have `/dev/stderr`, you can use `perl` that way:


{
your-code
..
} | perl -pe 'print STDERR'


`perl` processes the input one line at a time, so you won't see partial lines there. For instance with code like:


printf 'Foo'; sleep 2; printf 'Bar\
'


You'll only see `FooBar` after 2 seconds.

Also note that some commands buffer their output when it doesn't go to a terminal, so that may affect the way the output is done.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e398db64549895ef6d277622066ee2c8