You dont need fquote and fdquote, just use quotes where you need them. It will honestly make it much clearer. The syntax to shell scripts hasn't changed much in 25 years, these things don't need to be variables.
also you don't need the sleep.
Once you've simplified it, then repost it and we can have another look.
