I used to do that. Them move to a NodeJS script.

Because bash is maybe worst than C for this task.