Question: proc1.sh
========

```
#!/bin/sh
touch /tmp/proc1.signature.mutex
#do something for long time
sleep 100 
rm -rf /tmp/proc1.signature.mutex

```

proc2.sh
========

```
#!/bin/sh
touch /tmp/proc2.signature.mutex
#do something for long time
sleep 100 
rm -rf /tmp/proc2.signature.mutex

```

proc3.sh
========

```
#!/bin/sh
touch /tmp/proc3.signature.mutex
#do something for long time
sleep 100 
rm -rf /tmp/proc3.signature.mutex

```

core.sh
=======

Now is there a way to wait for deleting /tmp/proc[?][\*].signature.mutex all such file using loop or something 
and then continue further execution 

How to achieve objective of core.sh

Answer: 
I wrote <https://github.com/acbits/sema> for this exact reason. I haven't been active on SE for a long time and just noticed this question. I have tested it only on Linux
Use <https://github.com/acbits/sema> to use semaphores in shell scripts.

```
 A.sh 
_____________________________________________
#!/bin/sh

echo A.sh started
sema -c S1
./B.sh &
echo A.sh more work
echo waiting for B.sh to finish
sema -w S1
echo B.sh finished execution
echo A.sh do more work
# cleanup semaphores
sema -d S1
_____________________________________________

B.sh
_____________________________________________
#!/bin/sh

echo Hello from B.sh
sleep 5
sema -r S1
echo Bye bye from B.sh
____________________________________________

```