Skip to content

fix!: use `bash` for `env.sh` to provide access to its true location

Baltzell, Nathan requested to merge github/fork/c-dilks/bash-env into development

Created by: c-dilks

Using $0 and $1 in env.sh when called as

. bin/env.sh    # or source bin/env.sh

depends on the shell. Ideally, we want:

$0 = bin/env.sh
$1 = whatever additional argument was supplied to the '. bin/env.sh' call (see 'run-groovy')

However, these may not be the case depending on the shell (especially for dash, which may be used in place of sh).

Since there is no POSIX-compliant way to get the true script name, this PR proposes switching env.sh to be in bash, so that we may prioritize using $BASH_SOURCE[0] in place of $0 to get the true bin/env.sh path.

All sh scripts which source bin/env.sh are also converted to bash.

Merge request reports