source:
branches/UKMO/v3_6_extra_CMIP6_diagnostics/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh
@
12555
Last change on this file since 12555 was 7491, checked in by timgraham, 8 years ago | |
---|---|
|
|
File size: 2.0 KB |
Rev | Line | |
---|---|---|
[2302] | 1 | #!/bin/bash |
2 | ###################################################### | |
3 | # Author : Simona Flavoni for NEMO | |
4 | # Contact : sflod@locean-ipsl.upmc.fr | |
5 | # | |
[2359] | 6 | # Some functions called from makenemo |
[2302] | 7 | # Fadd_keys : add keys in cpp.fcm file |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
[2520] | 15 | # ============ |
[2302] | 16 | # Fadd_keys.sh |
[2520] | 17 | # ============ |
[2302] | 18 | # |
[2520] | 19 | # -------------------- |
[2302] | 20 | # Add compilation keys |
[2520] | 21 | # -------------------- |
[2302] | 22 | # |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
[2318] | 28 | # $ Fadd_keys.sh CONFIG_NAME add_key "LIST_KEYS" |
[2302] | 29 | # |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
[4990] | 35 | # Script to add a set of key when compiling a configuration. |
36 | # The list of key to be added has to be enclosed with " ". | |
[2520] | 37 | # A 'sed' is performed to modify the CONFIG_NAME/cpp.fcm file to |
38 | # add the new key(s). | |
[2302] | 39 | # |
40 | # | |
41 | # EXAMPLES | |
42 | # ======== | |
43 | # | |
44 | # :: | |
45 | # | |
[2520] | 46 | # $ ./Fadd_keys.sh ORCA2_LIM add_key "key_mpp_mpi key_nproci=1 key_nprocj=10" |
[2302] | 47 | # |
48 | # | |
49 | # TODO | |
50 | # ==== | |
51 | # | |
52 | # option debug | |
53 | # | |
54 | # | |
55 | # EVOLUTIONS | |
56 | # ========== | |
57 | # | |
[7491] | 58 | # $Id$ |
[2302] | 59 | # |
60 | # | |
61 | # | |
62 | # * creation | |
63 | # | |
64 | #- | |
65 | echo "Adding keys in : ${NEW_CONF}" | |
66 | for i in ${list_add_key} ; do | |
[2538] | 67 | if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ] ; then |
[2603] | 68 | sed -e "s/key_nproc[ij]=.[0-9]* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp |
[2306] | 69 | mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm |
70 | echo " " | |
71 | sed -e "s/$/ ${i}/" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp | |
72 | mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | |
73 | elif [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ] ; then | |
[2302] | 74 | echo "key $i already present in cpp_${NEW_CONF}.fcm" |
75 | else | |
76 | sed -e "s/$/ ${i}/" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp | |
77 | mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | |
78 | echo "added key $i in ${NEW_CONF}" | |
79 | fi | |
80 | done | |
81 | ||
82 | unset -v list_add_key | |
83 |
Note: See TracBrowser
for help on using the repository browser.