New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Fadd_keys.sh in trunk/NEMOGCM/TOOLS/COMPILE – NEMO

source: trunk/NEMOGCM/TOOLS/COMPILE/Fadd_keys.sh @ 9298

Last change on this file since 9298 was 8281, checked in by clem, 7 years ago

solve issues with adding/deleting keys for all the keys

  • Property svn:executable set to *
File size: 1.5 KB
RevLine 
[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
10set -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#
[7646]46#  $ ./Fadd_keys.sh ORCA2_LIM add_key "key_mpp_rep"
[2302]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
[8281]67   if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
[7646]68      echo "key $i already present in cpp_${NEW_CONF}.fcm" 
[2302]69   else
[7646]70      sed -e "s/$/ ${i}/"  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
71      mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp   ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
72      echo "added key $i in ${NEW_CONF}" 
[2302]73   fi
74 done
75 
76 unset -v list_add_key
77
Note: See TracBrowser for help on using the repository browser.