source:
trunk/NEMOGCM/TOOLS/COMPILE/Fdel_keys.sh
@
4409
Last change on this file since 4409 was 2584, checked in by flavoni, 13 years ago | |
---|---|
|
|
File size: 1.8 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 | # Fdel_keys : del keys in cpp.fcm file |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
15 | # ================ | |
16 | # Fdel_keys.sh | |
17 | # ================ | |
18 | # | |
19 | # -------------------------- | |
20 | # Add compilation keys | |
21 | # -------------------------- | |
22 | # | |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
[2318] | 28 | # $ Fdel_keys.sh CONFIG_NAME del_key "LIST_KEYS" |
[2302] | 29 | # |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
[2520] | 35 | # Add cpp keys when compiling a configuration, key list has to be enclosed with " ". |
36 | # We perform a 'sed' on the CONFIG_NAME/CPP.fcm file, contianing the list of keys. | |
[2302] | 37 | # |
38 | # EXAMPLES | |
39 | # ======== | |
40 | # | |
41 | # :: | |
42 | # | |
[2520] | 43 | # $ ./Fdel_keys.sh CONFIG_NAME del_key "key_agrif" |
[2302] | 44 | # |
45 | # | |
46 | # TODO | |
47 | # ==== | |
48 | # | |
49 | # option debug | |
50 | # | |
51 | # | |
52 | # EVOLUTIONS | |
53 | # ========== | |
54 | # | |
55 | # $Id: Fdel_keys.sh 2158 2010-10-20 17:30:03Z sflod $ | |
56 | # | |
57 | # | |
58 | # | |
59 | # * creation | |
60 | # | |
61 | #- | |
[2584] | 62 | echo "Removing keys in : ${NEW_CONF}" |
63 | for i in ${list_del_key} ; do | |
64 | if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ] ; then | |
65 | sed -e "s/key_nproc[ij]=.* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp | |
66 | mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | |
67 | echo " " | |
68 | elif [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ] ; then | |
69 | sed -e "s/${i}//" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp | |
70 | mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | |
71 | echo "deleted key $i in ${NEW_CONF}" | |
72 | fi | |
73 | done | |
[2302] | 74 | |
75 | unset -v list_del_key |
Note: See TracBrowser
for help on using the repository browser.