Added finer granularity to OS detection for deciding what extension to use. OSX apparently uses .command, also added a thing so that it will execute in a terminal for OSX as OSX doesn't have xterm apparently. Hopefully it works, I can't test due to a lack of appropriate hardware.