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

  • Home
  • SEARCH
  • 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 9209039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:44:56+00:00 2026-06-18T00:44:56+00:00

I normally run multiple commands with something like this: sleep 2 && sleep 3

  • 0

I normally run multiple commands with something like this:

sleep 2 && sleep 3

or

sleep 2 ; sleep 3

but what if I want to run them both in the background from one command line command?

sleep 2 & && sleep 3 &

doesn’t work. And neither does replacing && with ;

Is there a way to do it?

  • 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-06-18T00:44:57+00:00Added an answer on June 18, 2026 at 12:44 am

    Exactly how do you want them to run? If you want them to be started in the background and run sequentially, you would do something like this:

    { sleep 2; sleep 3; } &
    

    If you want sleep 3 to run only if sleep 2 succeeds, then:

    sleep 2 && sleep 3 &
    

    If, on the other hand, you would like them to run in parallel in the background, you can instead do this:

    sleep 2 & sleep 3 &
    

    And the two techniques could be combined, such as:

    { sleep 2; echo first finished; } & { sleep 3; echo second finished; } &
    

    Bash being bash, there’s often a multitude of different techniques to accomplish the same task, although sometimes with subtle differences between them.

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

Sidebar

Related Questions

It am trying to launch this code that would normally run from a batch
I get this error when I run the code below. I have normally used
I want to write a CMakeLists.txt so that I can run my tests normally
I have a program that normally run till it terminates, but under some situations,
I've been designing a website and when testing it I normally run it by
Normally if I run the following the following command in the rhino shell, mbp001:rhino1_7R2
Normally, you don't actually edit a file in vim. If you run vim foo
I'm using SqlClient.SqlCommand object to run a few stored procs on my db. Normally
Use case: class MyTask(Task): queue = 'default_queue' def run(self): # do work Normally I
Normally when I want to change the connection for a Query Editor Window in

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.