Root:
With the exception of my own, I think you’re getting good advice here and you should be careful to follow it as closely as possible.
That said, in similar (not the same) situations/scenarios, I’ve found it necessary to compress (ZIP) the modified script, throw away the original (and any/all similarly modified precursors), empty the trash… and sometimes logout/login before LaunchServices will ‘see’ that there’s a new app in play… and deal with it accordingly.
As arbitrary as they may seem sometimes, there are ‘rules’ to these games. If not adhered to, failure is pretty much certain.
Owlishly,
Peter B.