Make this script work. Sortof.

and even if it still doesn't work, include sh -x output so we see what happens.