Newer
Older
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
######################################################
# Author : Simona Flavoni for NEMO
# Contact : sflod@locean-ipsl.upmc.fr
#
# Some functions called from makenemo
# Fadd_keys : add keys in cpp.fcm file
######################################################
#set -x
set -o posix
#set -u
#set -e
#+
#
# ============
# Fadd_keys.sh
# ============
#
# --------------------
# Add compilation keys
# --------------------
#
# SYNOPSIS
# ========
#
# ::
#
# $ Fadd_keys.sh CONFIG_NAME add_key "LIST_KEYS"
#
#
# DESCRIPTION
# ===========
#
#
# Script to add a set of key when compiling a configuration.
# The list of key to be added has to be enclosed with " ".
# A 'sed' is performed to modify the CONFIG_NAME/cpp.fcm file to
# add the new key(s).
#
#
# EXAMPLES
# ========
#
# ::
#
# $ ./Fadd_keys.sh ORCA2_LIM add_key "key_mpp_rep"
#
#
# TODO
# ====
#
# option debug
#
#
# EVOLUTIONS
# ==========
#
# $Id: Fadd_keys.sh 2158 2010-10-20 17:30:03Z sflod $
#
#
#
# * creation
#
#-
echo "Adding keys ${2} in : ${1}"
for i in ${2} ; do
if [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
echo "key $i already present in cpp_$(basename ${1}).fcm"
else

Guillaume Samson
committed
sed -i'' -e "s/$/ ${i}/" ${1}/cpp_$(basename ${1}).fcm
echo "added key $i in $(basename ${1})"
fi
done