Changeset 1081
- Timestamp:
- 10/07/14 12:27:21 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
r1080 r1081 957 957 # 958 958 # Arguments: 959 # - type : first argument must be blocker or nonblocker.959 # - type : first argument must be blocker, nonblocker or force 960 960 # For "blocker" case, the variable must be attributed the keyworld AUTO 961 961 # otherwise this function will exit. 962 962 # For "nonblocker" case, the user can remove or modify the variable. For 963 963 # this case, as long as AUTO is not set, no modification will be done. 964 # For "force" case, the variable will be modified even if it is not set to AUTO 964 965 # - filein : the file in run directory of .def type in which the variable should be set 965 966 # - key : the variable to modify … … 984 985 IGCM_debug_Print 1 "Entering IGCM_comp_modifyDefFile with arguments: $type $filein $key $value" 985 986 987 986 988 # Test if first argument is correct 987 if [ $type != blocker ] && [ $type != nonblocker ] ; then988 IGCM_debug_Exit "IGCM_comp_modifyDefFile: Error in first argument must be blocker or nonblocker"989 if [ $type != blocker ] && [ $type != nonblocker ] && [ $type != force ] ; then 990 IGCM_debug_Exit "IGCM_comp_modifyDefFile: Error in first argument must be blocker, nonblocker or force" 989 991 IGCM_debug_PopStack "IGCM_comp_modifyDefFile" 990 992 return … … 1020 1022 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile: $key is not set in $filein. This is a nonblocker call so nothing is done." 1021 1023 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile: Default value for $key from the model will be used." 1024 modify=no 1022 1025 elif [ $( grep $key $filein | grep -v "\#" |wc -l ) = 0 ] ; then 1023 1026 # Variable key is not set in filein, stop. 1024 1027 IGCM_debug_Exit "IGCM_comp_modifyDefFile : Variable $key is not set in correct file. It should be set in $filein." 1028 fi 1029 1030 1031 # Check if AUTO is set in the filein on the same line as the key variable 1032 if [ $( grep $key $filein | grep -v "\#" | grep AUTO | wc -l ) = 1 ] ; then 1033 # Modification will be done for all cases 1034 modify=yes 1025 1035 else 1026 # Read the value of key from filein 1027 if [ X"$( grep $key $filein | grep -v "\#" | grep AUTO )" = "X" ] ; then 1028 # The key variable is not set to AUTO 1036 # The variable was not set to AUTO 1029 1037 if [ $type = blocker ] ; then 1030 # Stop because this is a blocker call 1031 IGCM_debug_Exit "IGCM_comp_modifyDefFile : The variable $key cannot be modified. It should be set to AUTO." 1032 else 1033 # Do nothing. Suppose that the user did set the variable correct 1034 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile: $key is set by the user. Nothing done." 1038 # Exit because this is a blocker call 1039 IGCM_debug_Exit "IGCM_comp_modifyDefFile : The variable $key cannot be modified. It should be set to AUTO." 1040 return 1041 elif [ $type = nonblocker ] ; then 1042 # Do nothing. Suppose that the user did set the variable correct 1043 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile: $key is set by the user. Nothing done." 1044 modify=no 1045 elif [ $type = force ] ; then 1046 # Force modification 1047 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile : Variabl=$key was not set to AUTO. Modification will be forced." 1048 modify=yes 1035 1049 fi 1036 else 1037 # The variable key is set to AUTO. 1050 fi 1051 1052 # Do the modifcation now 1053 if [ $modify = yes ] ; then 1038 1054 1039 1055 # For option DEFAULT, read default value from file. … … 1056 1072 IGCM_debug_Print 1 "IGCM_comp_modifyDefFile: In $filein set $key=$value" 1057 1073 \mv $filein.tmp $filein 1058 fi1059 1074 fi 1060 1075 IGCM_debug_PopStack "IGCM_comp_modifyDefFile"
Note: See TracChangeset
for help on using the changeset viewer.