For starters, it won't work in dash (Debian and Ubuntu /bin/sh implementation). So the shebang line should be changed to #!/bin/bash (not sure if it would work in Zsh either).
Broken! Can we please just pick one convention and stick with it? Oh, standards... so many to choose from.