Jump to content

Concurrently run every line in a bash script

babadoctor
Go to solution Solved by Sauron,
2 minutes ago, babadoctor said:

Is there a better way of doing it than this?

No. What's wrong with the ampersand operator that you feel the need to look for something else?

3 minutes ago, babadoctor said:

also running thousands of lines concurrently might crash my computer

Not really, no. Plus wget will be bottlenecked by your connection long before it overwhelms your cpu. If you don't want messy output you can redirect each command's output to /dev/null:

wget x.png > /dev/null 2>&1 &

 

I have a script that looks like this

 

wget x.jpg

wget y.jpg

wget z.webm

etc...

 

how do I run all of these lines at once in separate forks?


I thought of using the ampersand operator after every line, but...

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, babadoctor said:

I thought of using the ampersand operator after every line, but...

But...?

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Sauron said:

But...?

Is there a better way of doing it than this?

 

also running thousands of lines concurrently might crash my computer

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, babadoctor said:

Is there a better way of doing it than this?

No. What's wrong with the ampersand operator that you feel the need to look for something else?

3 minutes ago, babadoctor said:

also running thousands of lines concurrently might crash my computer

Not really, no. Plus wget will be bottlenecked by your connection long before it overwhelms your cpu. If you don't want messy output you can redirect each command's output to /dev/null:

wget x.png > /dev/null 2>&1 &

 

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×