Refactor environment variable handling into an env.sh

Makes it much easier to pick up again from a fresh terminal.