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

Ignore:
Timestamp:
2010-12-23T15:26:52+01:00 (13 years ago)
Author:
flavoni
Message:

add control number of arguments for set_namelist function in SETTE, see ticket #752

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/nemo_v3_3_beta/NEMOGCM/SETTE/all_functions.sh

    r2510 r2511  
    7474# function to set namelists parameters 
    7575set_namelist () { 
    76      VAR_NAME=$( supergrep $2 ${INPUT_DIR}/$1 ) 
    77      sed -e "s/${VAR_NAME}/$2=$3/"  ${INPUT_DIR}/$1 > ${INPUT_DIR}/$1.tmp 
    78      mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1 
     76   minargcount=3 
     77      if [ ${#} -lt ${minargcount} ] 
     78      then 
     79      echo "not enought arguments" 
     80      echo "${usage}" 
     81      exit 1 
     82      fi 
     83   unset minargcount 
     84   VAR_NAME=$( supergrep $2 ${INPUT_DIR}/$1 ) 
     85      sed -e "s/${VAR_NAME}/$2=$3/"  ${INPUT_DIR}/$1 > ${INPUT_DIR}/$1.tmp 
     86      mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1 
    7987} 
Note: See TracChangeset for help on using the changeset viewer.