![]() |
|
[Shell] Bash wait for a command to finish then execute another command - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Bash wait for a command to finish then execute another command (/showthread.php?tid=6046044) |
Bash wait for a command to finish then execute another command - friiz1337 - Feb 2, 2020 Hello guys. I have a problem waiting for a specific command within an infinite loop to finish, so another command in another loop to execute. Also the command that I'm waiting to finish is located in a background loop (&). I tried getting the PID of the mv command and then wait for this process to finish but it didn't work to save it as a global variable with process substitution. Here is an example code of what is happening: Code while true; doRE: Bash wait for a command to finish then execute another command - FantaĆ ec - Feb 3, 2020 The bash script executes sequentially, not in parallel. The functionality you are looking for already exists without special logic you need to create. If you can provide more background on the goal/intent I can help a bit more; however, in what is shown already, bash will execute the Mv command and wait for completion or error before moving on to next line (unless you force bash to not do this using & or other methods). RE: Bash wait for a command to finish then execute another command - sed-i - May 14, 2020 Code LOOP1 () {old post lol, but prbly very simple. |