Feb 2, 2020 05:48 AM
(This post was last modified: Feb 2, 2020 05:49 AM by friiz1337.)
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:
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; do
echo "Renaming File"
mv File1 File2
sleep 2
echo "Renaming File again"
mv File2 File1
done &
while true; do
wait for the mv File2 File1 command to finish
execute another command
done
