source:
branches/nemo_v3_3_beta/NEMOGCM/SETTE/all_function.sh
@
2354
Last change on this file since 2354 was 2354, checked in by flavoni, 13 years ago | |
---|---|
|
|
File size: 525 bytes |
Rev | Line | |
---|---|---|
[2354] | 1 | #!/bin/bash |
2 | # function set_namelist | |
3 | # input variable value | |
4 | # output namelist | |
5 | ||
6 | # function to find namelists parameters | |
7 | supergrep () { | |
8 | grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" | |
9 | } | |
10 | ||
11 | # USAGE : if you want to add a string with " : ./test var_name \"new_value\" | |
12 | # function to set namelists parameters | |
13 | set_namelist () { | |
14 | VAR_NAME=$( supergrep $1 ${INPUT_DIR}/namelist ) | |
15 | sed -e "s/${VAR_NAME}/$1=$2/" ${INPUT_DIR}/namelist > ${INPUT_DIR}/namelist.tmp | |
16 | mv ${INPUT_DIR}/namelist.tmp ${INPUT_DIR}/namelist | |
17 | } |
Note: See TracBrowser
for help on using the repository browser.