diff --git a/require-ess/tools/iocsh.bash b/require-ess/tools/iocsh.bash index 617886833e23ed68390ab0bb1ce1e5d0e2125206..8296841b49127c88f109df4255611406ac9bb0c9 100644 --- a/require-ess/tools/iocsh.bash +++ b/require-ess/tools/iocsh.bash @@ -61,7 +61,7 @@ IOCSH_TOP=${PWD} # Load any environment variables, default is $IOCSH_TOP/env.sh loadEnv "$@" -# The most unique environment variable for e3 is EPICS_DRIVER_PATH +# Check whether an expected e3 environment variable is defined. # if [[ -z "${EPICS_DRIVER_PATH}" ]]; then set -a @@ -70,6 +70,18 @@ if [[ -z "${EPICS_DRIVER_PATH}" ]]; then set +a fi +# Check that the e3 environment definition and the path for this script +# are consistent +if [ "${E3_REQUIRE_BIN}" != "${SC_TOP}" ]; then + echo "Error: Configured e3 environment does not match path for iocsh.bash executable." + echo "Please source the appropriate setE3Env.bash file for the version" + echo "of iocsh.bash you wish to use, or run iocsh.bash from a clean" + echo "environment so it can set the environment correctly." + echo "Expected path to iocsh.bash from environment = ${E3_REQUIRE_BIN}" + echo "Actual path to iocsh.bash = ${SC_TOP}" + die 2 +fi + BASECODE="$(basecode_generator)" check_mandatory_env_settings