Salome HOME
2ab579ce6d80091da99e6d26e688f40944089969
[modules/kernel.git] / bin / appliskel / runSession
1 #!/bin/bash
2 #
3 # Useful shell to run executable progs or shells under Salome env
4 # Use it with args to run a program : runSession python -i myprog.py
5 # Use it without args to run an interactive shell under Salome env
6 #
7
8 # --- retrieve APPLI path, relative to $HOME
9 #     on sarge, "which" gives not allways the absolute path...
10      
11 comName=`which $0`
12 aa=${comName:0:1}
13 if test x$aa == x\/; then
14   mycom=${comName}
15 elif test x$aa == x\.; then
16   mycom=${PWD}/${comName:2}
17 else
18   mycom=${PWD}/${comName}
19 fi
20 APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
21 echo $APPLI
22 export APPLI
23
24 # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
25
26 . ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
27
28 myhost=`hostname`
29 export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
30
31 # --- invoque shell with or without args
32
33 if [ $# -ne 0 ] ; then
34     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
35 else
36
37     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
38 fi