-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv.sh
executable file
·64 lines (53 loc) · 1.04 KB
/
env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
BASE_PATH=`dirname $(readlink -e $BASH_SOURCE)`
function do_exit()
{
unset HOSTS
unset BASE_PATH
unset HOST_PATH
unset MODULEPATH_BAK
}
HOSTS=
for host in `find $BASE_PATH -maxdepth 1 -type d`
do
if [ -e ${host}/info.sh ]
then
HOSTS="${host} ${HOSTS}"
fi
done
if [ x"$1" == x"--help" ]
then
echo "Available hosts:"
fi
for host in $HOSTS
do
source ${host}/info.sh
if [ x"$1" == x"--help" ]
then
echo " - ${NAME}"
fi
if [ x"${VALID}" == x"true" ]
then
current_host=${NAME}
HOST_PATH=${host}
fi
done
if [ x"$1" == x"--help" ]
then
echo ""
fi
if [ x"${current_host}" != x"" ]
then
echo "Loading environment for $current_host"
echo ""
else
echo "hostname \"$(hostname)\" is not supported."
do_exit
fi
. $HOST_PATH/env.sh
MODULEPATH_BAK=$MODULEPATH
MODULEPATH=$TAU_MODULEPATH:$HPX_MODULEPATH
echo "Newly available modules:"
module avail
MODULEPATH=$MODULEPATH_BAK:$MODULEPATH
do_exit