Fixes and lint cleanup on wrapper

I found some problems in `gcc-rtags-wrapper.sh` when looking at it to figure out what exactly it does.  I have not been able to test the changes as I am still trying to get rtags set up, but these changes should not break the behaviour with existing workflows (so long as the workflow does not workaround any bugs fixed here).