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.
all_functions.sh in branches/nemo_v3_3_beta/NEMOGCM/SETTE – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/SETTE/all_functions.sh @ 2494

Last change on this file since 2494 was 2494, checked in by flavoni, 14 years ago

add README to use sette utility, and small enhancements, see ticket #752

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2######################################################
3# Author : Simona Flavoni for NEMO
4# Contact : sflod@locean-ipsl.upmc.fr
5#
6# Some scripts called by sette.sh
7# all_functions.sh   : all functions used by sette.sh 
8######################################################
9#set -x
10set -o posix
11#set -u
12#set -e
13#+
14#
15# ================
16# all_functions.sh
17# ================
18#
19# ----------------------------------------------
20# Set of functions used by sette.sh (NEMO tests)
21# ----------------------------------------------
22#
23# SYNOPSIS
24# ========
25#
26# ::
27#
28#  $ ./set_namelist.sh INPUT_NAMELIST VARIABLE VALUE
29#
30#
31# DESCRIPTION
32# ===========
33#
34#
35# Simple job for SET TESTS for NEMO (SETTE)
36
37# function superegrep
38# input variable value
39
40# function set_namelist
41# input namelist_name variable value
42# output namelist
43
44# function to find namelists parameters
45supergrep () {
46            grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
47    }
48
49usage=" Usage : set_namelist input_namelist variable_name value"
50usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name var_name \"new_value\"
51
52# function to set namelists parameters
53set_namelist () {
54     VAR_NAME=$( supergrep $1 ${INPUT_DIR}/namelist )
55     sed -e "s/${VAR_NAME}/$1=$2/"  ${INPUT_DIR}/namelist > ${INPUT_DIR}/namelist.tmp
56     mv ${INPUT_DIR}/namelist.tmp ${INPUT_DIR}/namelist
57}
Note: See TracBrowser for help on using the repository browser.