myBashFunctions.sh 846 Bytes
Newer Older
sergeizharko's avatar
sergeizharko committed
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
######
#
#   Script:      
#     myBashFunctions.sh                                                          
#   
#   Description:
#     The script defines several useful comands for bash terminal to work with cbmroot.
#
######

REGEXP_ISINTEGER='^[0-9]+$'

# Command to rebuild cbmroot from any place of code
rebuild-cbm() {
  # Variables 
  local N_THREADS=1

  # Check input parameters 
  while [[ $# > 0 ]]; do
    echo ${1}
    case ${1} in
      -j )
        if [[ ${2} =~ $REGEXP_ISINTEGER ]]; then
          N_THREADS=${2}
        fi 
        ;;
      * ) 
        ;;
    esac
    shift
  done

  # Run cbmroot compilation
  pushd .
  cd $VMCWORKDIR/build
  make -j"${N_THREADS}"
  RES=$?
  popd
  if [[ $RES -eq 0 ]]; then
    echo "CbmRoot compiled successfully!"
  else
    echo "CbmRoot was not compiled, some errors occured"
  fi
}