Producer-consumer pattern implementation in bash