From dd2ec404e859e0fdc05ea2bc19055e22f2e37322 Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Sun, 13 Jun 2021 03:22:36 +0000 Subject: [PATCH] only export the helper functions for bash --- containers/jug/eic-env.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/containers/jug/eic-env.sh b/containers/jug/eic-env.sh index 28d42a50d..77b3ca193 100755 --- a/containers/jug/eic-env.sh +++ b/containers/jug/eic-env.sh @@ -8,11 +8,22 @@ export PS1='eic-shell> \[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[ export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33' export GREP_OPTIONS='--color=auto' +## redefine ls and less as functions, as this is something we +## can import into our plain bash --norc --noprofile session +## (aliases cannot be transferred to a child shell) function ls { - /bin/ls --color=auto - } + /bin/ls --color=auto +} function less { - /usr/bin/less -RAW_CONTROL_CHARS - } -export -f ls -export -f less + /usr/bin/less -R +} +MYSHELL=$(ps -p $$ | awk '{print($4);}' | tail -n1) +## only export the functions for bash, as this does not work +## in all shells and we only care about bash here. Note that +## the singularity startup runs in plain sh which requires the +## if statement +if [ "$MYSHELL" == "bash" ]; then + export -f ls + export -f less +fi +unset MYSHELL -- GitLab