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 6134823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:24:15+00:00 2026-05-23T17:24:15+00:00

If I type: progA | progB && progC then progC is conditional on progB

  • 0

If I type:

progA | progB && progC

then progC is conditional on progB, and not on progA. Is there a way to both pipe the output of progA to progB, and then, after progA is done (and if I have to wait for progB to be done too, then that’s not a problem) have progC be conditional on prog A?

Also, I need to keep the pipe — as in I can’t afford to do progA > file; ....; progB < file and loose the time efficiency.

EDIT: How to use the return code of the first program in a pipe command line is a similar question, but does not have constraint of keeping the pipe, and it also assumes that I have access to the code of progB.

  • 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-23T17:24:15+00:00Added an answer on May 23, 2026 at 5:24 pm

    Use a named pipe.

    With variations on grep as progA and cat as progB:

    $ cat input
    foo
    bar 
    baz
    $ grep fool < input > fifo & cat fifo & wait %1 && echo good || echo bad
    [1] 13876
    [2] 13877
    [1]-  Exit 1                  grep fool < input > fifo
    bad
    [2]+  Done                    cat fifo
    $ grep foo < input > fifo & cat fifo & wait %1 && echo good || echo bad
    [1] 13878
    [2] 13879
    foo
    [1]-  Done                    grep foo < input > fifo
    good
    [2]+  Done                    cat fifo
    

    Note that wait without a job ID will always return 0 no matter what the exit status of the background job was and that wait %1 in a separate command will not work when the job exits before you start the wait. I wouldn’t want to put this into production really. All this was tested on bash btw and might be slightly different for other shells.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Type.GetFields() does not return fields in a particular order, but I want to sort
TYPE *a = calloc(nelem, sizeof(TYPE)); It says unable to resolve identifier TYPE. What does
type TSomeRecord = Record field1: integer; field2: string; field3: boolean; End; var SomeRecord: TSomeRecord;
type(3,) returns the int type, while t = 3, type(t) returns the tuple type.
The type of each member of the structure usually has a default alignment i.e.each
The type of this function is T -> (T -> U) -> U .
What type of transaction management strategy we should use in Spring? Declarative or Programmatic?
System.Type contains an UnderlyingSystemType property. MSDN states that it: Indicates the type provided by
What type of iPhone application file should I use? Before, I was trying to
Content type Events has intro, body and an event date field (using Date module).

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.