-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSETUP.bash
More file actions
executable file
·44 lines (34 loc) · 1.4 KB
/
SETUP.bash
File metadata and controls
executable file
·44 lines (34 loc) · 1.4 KB
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
#!/usr/bin/env bash
#
#Crab_BIN_SETUP_SCRIPT=$(dirname "${BASH_SOURCE[0]}")/bin/bin_setup.bash
#source "$Crab_BIN_SETUP_SCRIPT" -check casa-ms-split casa-ms-concat pdbi-uvt-go-splitpolar pdbi-uvt-go-import-uvfits pdbi-uvt-go-average pdbi-uvt-go-uvfit
export Crab_Toolkit_CASA_PATH=$(dirname $(perl -MCwd -e 'print Cwd::abs_path shift' "${BASH_SOURCE[0]}"))
# write startup file
# see https://casaguides.nrao.edu/index.php/Analysis_Utilities
if [[ ! -d "$HOME/.casa" ]]; then
mkdir -p "$HOME/.casa"
fi
do_write_file=1
if [[ -f "$HOME/.casa/init.py" ]]; then
if [[ $(grep "${Crab_Toolkit_CASA_PATH}/lib/python" "$HOME/.casa/init.py" | wc -l) -ge 1 ]]; then
do_write_file=0
fi
fi
if [[ $do_write_file -eq 1 ]]; then
echo "" >> "$HOME/.casa/init.py"
echo "import sys" >> "$HOME/.casa/init.py"
echo "sys.path.append(\"${Crab_Toolkit_CASA_PATH}/lib/python\")" >> "$HOME/.casa/init.py"
echo "" >> "$HOME/.casa/init.py"
fi
do_write_file=1
if [[ -f "$HOME/.casa/startup.py" ]]; then
if [[ $(grep "${Crab_Toolkit_CASA_PATH}/lib/python" "$HOME/.casa/startup.py" | wc -l) -ge 1 ]]; then
do_write_file=0
fi
fi
if [[ $do_write_file -eq 1 ]]; then
echo "" >> "$HOME/.casa/startup.py"
echo "import sys" >> "$HOME/.casa/startup.py"
echo "sys.path.append(\"${Crab_Toolkit_CASA_PATH}/lib/python\")" >> "$HOME/.casa/startup.py"
echo "" >> "$HOME/.casa/startup.py"
fi