Find the answer to your Linux question:
Results 1 to 4 of 4
I Have an script like ./bang 1 ./bang 2 ./bang 3 ./bang 4 ./bang 5 ./bang 6 ./bang 7 ./bang 8 ./bang 9 ./bang 10 ./bang 11 ./bang 12 and ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2

    Bash script multithread in group of 3

    I Have an script like


    ./bang 1
    ./bang 2
    ./bang 3
    ./bang 4
    ./bang 5
    ./bang 6
    ./bang 7
    ./bang 8
    ./bang 9
    ./bang 10
    ./bang 11
    ./bang 12


    and i wanna execute him in groups of 3 , i mean he execute bang 1 , bang 2 and bang 3 after it finish the next 3 commands it will be executed and so on , in groups of 3.


    Regards
    John Hardey

  2. #2
    Linux Newbie
    Join Date
    Oct 2008
    Posts
    140
    I don't understand, you would like a delay between three and four and six and seven? Sleep would do that, but I think you want something else.


    Edit: Do you want to run three as part of a loop and then maybe run the next three?

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2
    I need to run 3 commands , after they finish the next 3 , because it is faster then one by one. and doesn`t need more resources .


    thanks

  4. #4
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Have a look at subshells and wait command in bash man pages.
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...