the `~` notation works only in bash (and it's derivates), but your is to be run by `sh` (declared at 1st line)
in many distros it doesn't matter, since `sh` is in fact link to `bash` or similar shell, but it might be a problem in some setups