Redirect standard error to input of other process, 2| ?

Hello,

I would like to know if there is a shell in which operations such as 2| (redirect standard error of one process to the standard input of another one) exist?
I know it is possible to do it in bash with things like:
(process 2>&1) | other_process
but I find it a bit intricate when dealing with several processes.

Ideally having a 3| rather than a 2| would be perfect (my ultimate goal is to pipe the output of process to tee to create two copies of it, for instance on stdout and on the descriptor number 3, so that two processes may work on it at the same time).

As far as I know there is no Unix or Linux shell that supports "filedescriptor|" semantics such as 2|

Hi.

There is a way (of sorts)!

But it does makes some assumptions:

  1. That my_process_1 and my_process_2 (see below) read only from pipes (and are happy to wait for data)
  2. You control how your program writes its output (i.e. it doesn't send stdout or stderr off somewhere else

Steps:

  1. Create two pipes:
    mknod STDOUT.pipe p
    mknod STDERR.pipe p

  2. Create two processes to read from these pipes, in the background
    cat STDOUT.pipe | ./my_process_1 &
    cat STDERR.pipe | ./my_process_2 &

In your program, or from a separate scripts direct STDOUT and STDERR to the new pipes
exec 1> STDOUT.pipe
exec 2> STDERR.pipe
your program call (or script) goes here

Thanks for the answers. I suspected that such a thing as 2| did not exist in any shell, but I thought this was the place to ask to be sure of it!

The idea of creating the pipes myself is pretty interesting. I don't acutally need to create a pipe for stdout since the regular pipe does that.
I tested the idea for counting the number of lines of a gzipped file and print the last lines by using one gunzip and piping the output to tee and two other processes:

mknod 3.pipe p
cat 3.pipe | wc -l &
zcat diff.gz | (tee /dev/fd/3 | tail -n 3) 3> 3.pipe

seems more easy to write than
zcat diff.gz | ((tee /dev/fd/3 | tail -n 3) 3>&1) | wc -l

(I'm not sure which of those parenthesis are necessary).

Thanks!