Is it possible to run two loops at the same time?

bash, shell

Solution

If you put a `&` after each `done`, like `done&`, you will create new processes in the background that run the while loops. You will have to be careful to realize what this means though, since the bash script will continue executing commands after creating those new processes even if they are not finished. You might use the `wait` command to prevent this from happening, but I'm not too used to using that so I cannot vouch for it.

Problem

So I have a project in my cyber security class to make a bash game. I like to make one of those medieval games where you make farms and mines to get resources. Well I like to make something like that. To do that I have to have two while loops running. Like this ``` while [ blah ]; do blah done while [ blah ]; do blah done ``` Is it possible to run two while loops at the same time and if I am writing it wrong how do I write it?

Original source

Related problems