Gentoo Archives: gentoo-user

From: Ramon Fischer <Ramon_Fischer@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Any way to run multiple commands from single script in parallel?
Date: Mon, 14 Mar 2022 10:37:18
Message-Id: AM6PR10MB244071DAD00B85EF49B1B8F5EF0F9@AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM
In Reply to: [gentoo-user] Any way to run multiple commands from single script in parallel? by "J. Roeleveld"
1 Hello Joost,
2
3 I suppose, that you are talking about Bash scripts.
4
5 If so, you may put each individual command in a subshell by using an
6 ampersand ("&") at the end of the line.
7
8 This example[1] shows it nicely.
9
10 -Ramon
11
12 [1] 3. Parallelize running commands by grabbing PIDs.:
13 https://will-keleher.com/posts/5-Useful-Bash-Patterns.html
14
15 On 14/03/2022 11:13, J. Roeleveld wrote:
16 > Hi,
17 >
18 > I often put multiple commands into a single file/script to be run in sequence.
19 > (each line can be executed individually, there is no dependency)
20 >
21 > Is there a tool/method to execute multiple lines/commands simultaneously? Like
22 > having 3 or 4 run together and when 1 is finished, it will grab the next one in
23 > the list?
24 >
25 > I would prefer this over simply splitting the file as the different lines/
26 > commands will not take the same amount of time.
27 >
28 > Thanks,
29 >
30 > Joost
31 >
32 >
33 >
34
35 --
36 GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature

Replies

Subject Author
RE: [gentoo-user] Any way to run multiple commands from single script in parallel? Laurence Perkins <lperkins@×××××××.net>