source:
branches/nemo_v3_3_beta/NEMOGCM/SETTE/all_functions.sh
@
2382
Last change on this file since 2382 was 2359, checked in by flavoni, 14 years ago | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[2359] | 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 | |
10 | set -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 | # $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC | |
29 | # | |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
35 | # Simple job for SET TESTS for NEMO (SETTE) | |
36 | ||
37 | # function set_namelist | |
38 | # input variable value | |
39 | # output namelist | |
40 | ||
41 | # function to find namelists parameters | |
42 | supergrep () { | |
43 | grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" | |
44 | } | |
45 | ||
46 | # USAGE : if you want to add a string with " : ./test var_name \"new_value\" | |
47 | # function to set namelists parameters | |
48 | set_namelist () { | |
49 | VAR_NAME=$( supergrep $1 ${INPUT_DIR}/namelist ) | |
50 | sed -e "s/${VAR_NAME}/$1=$2/" ${INPUT_DIR}/namelist > ${INPUT_DIR}/namelist.tmp | |
51 | mv ${INPUT_DIR}/namelist.tmp ${INPUT_DIR}/namelist | |
52 | } |
Note: See TracBrowser
for help on using the repository browser.