Env setup shell tweaks

Small tweaks to the `env-setup` script that improve its behaviour and reliability on other shells than bash, but also for bash.