help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Creating an anonymous pipe for later use


From: Russell Lewis
Subject: [Help-bash] Creating an anonymous pipe for later use
Date: Thu, 09 Oct 2014 08:11:01 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

I'm looking for a way to create an anonymous pipe in a bash script, which I can later attach to various processes - analogous to the pipe() call in a C program.

I'm hoping for some sort of command (I'll call it "pipe" in this email) which would call pipe(), and then assign the two file descriptors to variables. This would allow syntax like the following:
    pipe {read_end} {write_end}
    cmd1 >${write_end} &
    cmd2 <${read_end}  &
    exec -<${write_end}
    exec -<${read_end}

I know that you can do something close to this with a named pipe - however Linux's support for named pipes is less robust than its support for anonymous pipes. I've done a lot of experimentation with them, and have come to the conclusion that I should use anonymous pipes if at all possible. (I can give details in a separate email if anyone is interested.)

So, does Bash have any way to do this? I've Googled a lot, and as far as I can tell, Bash doesn't support this...but I was hoping that the experts might know something that I haven't discovered.

Thanks!
    Russ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]