Correct dirname invocation. Add PATH