source:
branches/UKMO/dev_r5785_SSS_obsoper/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh
@
7773
Last change on this file since 7773 was 4990, checked in by timgraham, 10 years ago | |
---|---|
|
|
File size: 2.1 KB |
Line | |
---|---|
1 | #!/bin/bash |
2 | ###################################################### |
3 | # Author : Simona Flavoni for NEMO |
4 | # Contact : sflod@locean-ipsl.upmc.fr |
5 | # |
6 | # Some functions called from makenemo |
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 | # |
15 | # ============ |
16 | # Fadd_keys.sh |
17 | # ============ |
18 | # |
19 | # -------------------- |
20 | # Add compilation keys |
21 | # -------------------- |
22 | # |
23 | # SYNOPSIS |
24 | # ======== |
25 | # |
26 | # :: |
27 | # |
28 | # $ Fadd_keys.sh CONFIG_NAME add_key "LIST_KEYS" |
29 | # |
30 | # |
31 | # DESCRIPTION |
32 | # =========== |
33 | # |
34 | # |
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 " ". |
37 | # A 'sed' is performed to modify the CONFIG_NAME/cpp.fcm file to |
38 | # add the new key(s). |
39 | # |
40 | # |
41 | # EXAMPLES |
42 | # ======== |
43 | # |
44 | # :: |
45 | # |
46 | # $ ./Fadd_keys.sh ORCA2_LIM add_key "key_mpp_mpi key_nproci=1 key_nprocj=10" |
47 | # |
48 | # |
49 | # TODO |
50 | # ==== |
51 | # |
52 | # option debug |
53 | # |
54 | # |
55 | # EVOLUTIONS |
56 | # ========== |
57 | # |
58 | # $Id: Fadd_keys.sh 2158 2010-10-20 17:30:03Z sflod $ |
59 | # |
60 | # |
61 | # |
62 | # * creation |
63 | # |
64 | #- |
65 | echo "Adding keys in : ${NEW_CONF}" |
66 | for i in ${list_add_key} ; do |
67 | if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ] ; then |
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 |
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 |
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.