Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1024341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:45:52+00:00 2026-05-16T11:45:52+00:00

I want to take stdout of a process and analyze it with three different

  • 0

I want to take stdout of a process and analyze it with three different programs. I have been able to use named pipes, but can I use fd’s instead.

Here’s what works so far:


exec 3< <(myprog)
tee p1 p2 >/dev/null <&3

cat p1|ap1 &
cat p2|ap2 &

p1 and p2 were created with mkfifo. ap1 and ap2 are analysis programs. I don’t know if I’m saying this right, but is there a way to tee into two new fd’s instead? Something like this:


exec 3< <(myprog)
tee >&4 >&5 <&3

cat <&4|ap1 &
cat <&5|ap2 &

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:45:53+00:00Added an answer on May 16, 2026 at 11:45 am

    You almost had it:

    myprog | tee >(ap1) >(ap2) >(ap3) >/dev/null
    

    Note that ap1 can be a function. If you want the function to have access to your script’s argument, call it with "$@", i.e.,

    ap1 () {
      # here the script arguments are available as $1, $2, ...
    }
    # ditto for ap2, ap3
    myprog | tee >(ap1 "$@") >(ap2 "$@") >(ap3 "$@") >/dev/null
    

    If your shell doesn’t support >() (bash, ksh and zsh do, but it’s not POSIX), but your OS nonetheless supports /dev/fd (most unices do, including Solaris, Linux, *BSD, OSX and Cygwin), you can use explicit fd shuffling.

    { { { myprog | tee /dev/fd/3 /dev/fd/4 |
          ap1 >&2
        } 3>&1 |
        ap2 >&2
      } 4>&1 |
      ap3 >&2
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to take advantage of DateTimePicker 's date validation, but the calendar seemed
I want to take an array and use that array's values to populate an
I have a Linux box and I want to be able to telnet into
I want to take advantage of the cStyleComment variable, but rather than just ignoring
I want to run many processes in parallel with ability to take stdout in
I want to take the latest 5 tweets from a twitter and have it
I want to take some fields from packet struct using pointer arithmetic.But what is
We want to take XML data and convert it to an NSDictionary object, but
I want to take a math expression that takes variables and print (assign to
I want to take backup or restore of my oracle database through .Net code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.