#!/usr/bin/env bash
# Configure bash behavior
#set -o xtrace # to debug
# Make sure home bin directory is in PATH
if ! [[ "${PATH}" =~ "${HOME}/bin" ]]; then
export PATH="${HOME}/bin:${PATH}"
fi
# Activate all Software collections - if any
IFS=$'\n' SCLS=($(scl --list)) && test ${#SCLS[@]} -eq 0 || source scl_source enable "${SCLS[@]}"
# Execute arguments as command if requested
if [ "$(basename "${0}")" == "$(basename ${BASH_SOURCE[0]})" -a ${#} -gt 0 ]; then
# Configure bash behavior
set -o errexit # exit on failed command
set -o nounset # exit on undeclared variables
set -o pipefail # exit on any failed command in pipes
# Expand arguments as command
exec "${@}"
fi