Skip to content

Instantly share code, notes, and snippets.

@prjemian
Last active February 10, 2019 18:02
Show Gist options
  • Select an option

  • Save prjemian/29a2175cfc42d87188ccfc056545ac73 to your computer and use it in GitHub Desktop.

Select an option

Save prjemian/29a2175cfc42d87188ccfc056545ac73 to your computer and use it in GitHub Desktop.
bash shell script to setup EPICS developer's environment
#!/bin/bash
# file: epics-env-setup.sh
# purpose: bash shell script to setup EPICS developer's environment
# usage:
# . /complete/path/to/epics-env-setup.sh
# example for ~/.bash_aliases file:
# _script=/usr/local/epics/epics-env-setup.sh
# if [ -f "${_script}" ]; then
# . "${_script}"
# fi
# unset _script
export EPICS_ROOT_DIR=/usr/local/epics
export EPICS_BASE=${EPICS_ROOT_DIR}/base-7.0.2
function appendPath() {
addition=$1 # addition must be a directory name
if [ -d "${addition}" ] && [[ "${PATH}" != *"${addition}"* ]]; then
# append only if not already in PATH
export PATH=${PATH}:${addition}
fi
unset addition
}
if [ -d "${EPICS_BASE}" ]; then
export EPICS_HOST_ARCH=`${EPICS_BASE}/startup/EpicsHostArch`
export EPICS_BASE_BIN=${EPICS_BASE}/bin/${EPICS_HOST_ARCH}
export EPICS_BASE_LIB=${EPICS_BASE}/lib/${EPICS_HOST_ARCH}
appendPath ${EPICS_BASE_BIN}
if [ -d "${EPICS_ROOT_DIR}/opi" ]; then
export EPICS_EXT_DIR=${EPICS_ROOT_DIR}/opi
elif [ -d "${EPICS_ROOT_DIR}/extensions" ]; then
export EPICS_EXT_DIR=${EPICS_ROOT_DIR}/extensions
fi
if [ -d "${EPICS_EXT_DIR}" ]; then
export EPICS_EXT_BIN=${EPICS_EXT_DIR}/bin/${EPICS_HOST_ARCH}
export EPICS_EXT_LIB=${EPICS_EXT_DIR}/lib/${EPICS_HOST_ARCH}
appendPath ${EPICS_EXT_BIN}
fi
export SYNAPPS_SUPPORT_DIR=${EPICS_ROOT_DIR}/synApps/support
appendPath ${SYNAPPS_SUPPORT_DIR}/utils
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment