Bash launcher refactor

This is the beginnings of a refactoring for the bash launcher.  I intend to modernize it and fix the following bug.

Currently the JRUBY_OPTS and option parsing code requires options that affect some kinds of code to be earlier in the option list than other kinds.  For example:

```
JRUBY_OPTS="--profile.html --profile.out test.html --sample" bin/jruby test.rb
```
this returns: jruby: unknown option --sample

```
bin/jruby --profile.html --profile.out test.html --sample test.rb
```
as does this.

This means that some options cannot currently be specified in JRUBY_OPTS if it is at all possible that anything launched with JRUBY_OPTS set may use some other options.

This rewrite is still in progress, I'm sending the pull request in case I end up not having time to finish it.
It is unclear to me why another 'cwd' variable is being assigned here when you can simply use $PWD?