source:
branches/UKMO/dev_r5518_seaiceobs/NEMOGCM/TOOLS/COMPILE/Fcheck_config.sh
Last change on this file was 6282, checked in by drew, 8 years ago | |
---|---|
|
|
File size: 1.6 KB |
Rev | Line | |
---|---|---|
[1972] | 1 | #!/bin/bash |
2 | ###################################################### | |
3 | # Author : Rachid Benshila for NEMO | |
4 | # Contact : rblod@locean-ipsl.upmc.fr | |
5 | # | |
[2359] | 6 | # Some functions called from makenemo |
[1972] | 7 | # Fcheck_config : config checking |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
15 | # ================ | |
16 | # Fcheck_config.sh | |
17 | # ================ | |
18 | # | |
19 | # -------------------------- | |
20 | # Check the configuration | |
21 | # -------------------------- | |
22 | # | |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
[2158] | 28 | # $ Fcheck_config.sh FILENAME CONFNAME |
[1972] | 29 | # |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
35 | # Check the choice of the configuration: | |
[2520] | 36 | # |
[1972] | 37 | # - Two cases |
38 | # - One is explicitely set | |
[2158] | 39 | # - Nothing set, use the previous in use |
[1972] | 40 | # |
[4990] | 41 | # We use TOOLS/CONFIG_DIR/cfg.txt to check if the configuration exists. |
[2520] | 42 | # |
[1972] | 43 | # EXAMPLES |
44 | # ======== | |
45 | # | |
46 | # :: | |
47 | # | |
48 | # $ ./Fcheck_config.sh | |
49 | # | |
50 | # | |
51 | # TODO | |
52 | # ==== | |
53 | # | |
54 | # option debug | |
55 | # | |
56 | # | |
57 | # EVOLUTIONS | |
58 | # ========== | |
59 | # | |
[6282] | 60 | # $Id: Fcheck_config.sh 4990 2014-12-15 16:42:49Z timgraham $ |
[1972] | 61 | # |
62 | # | |
63 | # | |
64 | # * creation | |
65 | # | |
66 | #- | |
67 | ||
68 | declare -a ZTAB | |
[2158] | 69 | if [ ${#2} -eq 0 ]; then |
[3294] | 70 | tail -1 ${CONFIG_DIR}/$1 > ${CONFIG_DIR}/cfg.tmp |
71 | read -a ZTAB < ${CONFIG_DIR}/cfg.tmp | |
[1972] | 72 | NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) |
[3294] | 73 | \rm ${CONFIG_DIR}/cfg.tmp |
[1972] | 74 | echo "Warning !!!" |
75 | echo "No configuration specified" | |
[2359] | 76 | echo "Use makenemo -n MYCONFIG" |
77 | echo "or makenemo -h for help" | |
[4990] | 78 | echo "Using default configuration : ${NEW_CONF}" |
[1972] | 79 | fi |
[2158] | 80 | if [ "$1" == cfg.txt ]; then |
[3294] | 81 | cat ${CONFIG_DIR}/$1 | grep "${NEW_CONF} " > ${CONFIG_DIR}/cfg.tmp |
82 | read -a ZTAB < ${CONFIG_DIR}/cfg.tmp | |
[2158] | 83 | NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) |
[3294] | 84 | \rm ${CONFIG_DIR}/cfg.tmp |
[2158] | 85 | fi |
[1972] | 86 | |
87 | unset -v ZTAB |
Note: See TracBrowser
for help on using the repository browser.