#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname -- "$0")/load.sh" || exit 1
export NULIBDIR NULIBINIT

ac_set_tmpfile bashrc
echo >"$bashrc" "\
if ! grep -q '/etc/bash.bashrc' /etc/profile; then
  [ -f /etc/bash.bashrc ] && source /etc/bash.bashrc
fi
if ! grep -q '~/.bashrc' ~/.bash_profile; then
  [ -f ~/.bashrc ] && source ~/.bashrc
fi
[ -f /etc/profile ] && source /etc/profile
[ -f ~/.bash_profile ] && source ~/.bash_profile

# Modifier le PATH. Ajouter le chemin vers les scripts de support
#PATH=$(qval "$MYDIR:$PATH")

if [ -n '$DEFAULT_PS1' ]; then
  DEFAULT_PS1=$(qval "[nulib-shell] $DEFAULT_PS1")
else
  if [ -z '$PS1' ]; then
    PS1='\\u@\\h \\w \\$ '
  fi
  PS1=\"[nulib-shell] \$PS1\"
fi
$(qvals source "$MYDIR/load.sh")"

"$SHELL" --rcfile "$bashrc" -i -- "$@"
# note: ne pas faire exec "$SHELL", parce que sinon le fichier temporaire bashrc
# n'est pas supprimé

ac_clean "$bashrc"
exit 0