#!/bin/bash

set_prefix() {
    local this=`readlink -n -f "$1"`
    prefix=`dirname "${this}"`
}

set_prefix "$0"
image=${prefix}/image

cat << EOF > run_script
cd /tmp
. /home/yjb/shenchao/kgcc9.3.1/install/code-aster-14.6.0/14.6/share/aster/profile.sh
/home/yjb/shenchao/kgcc9.3.1/install/code-aster-14.6.0/14.6/bin/aster ${@}
EOF
chmod 755 run_script

echo "Commands executed inside the container by 'run_script':"
echo ". /home/yjb/shenchao/kgcc9.3.1/install/code-aster-14.6.0/14.6/share/aster/profile.sh"
echo "/home/yjb/shenchao/kgcc9.3.1/install/code-aster-14.6.0/14.6/bin/aster ${@}"
echo

set -x
singularity exec \
     --bind $(pwd):/tmp ${image} \
    /tmp/run_script
