Changeset 3241


Ignore:
Timestamp:
2012-01-02T18:34:25+01:00 (9 years ago)
Author:
rblod
Message:

Add a check on the configuration to remove with clean_config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/TOOLS/COMPILE/Fclean_config.sh

    r3198 r3241  
    6464#- 
    6565 NEW_CONF=${x_n} 
    66  echo "Are you sure that you want to remove this directory ? [y/n] " 
    67  read answer 
    68  answer=`echo $answer | sed 's/^[y].*$/y/'` 
    69  if [  -z "$answer" -o "x$answer" = "xy" ]; then 
    70    # testing if configuration exists 
    71    if [ "$(cat ${CONFIG_DIR}/cfg.txt | grep "${NEW_CONF} ")"  == "" ] ; then 
    72       echo "The configuration ${NEW_CONF} does not exist in file cfg.txt"      
    73       echo "No removing configuration" 
    74       echo " " 
     66 if [ ${#NEW_CONF} -eq 0 ] ; then 
     67      echo " " 
     68      echo "No configuration specified, please use makenemo -n CONFIG clean_config " 
     69 else 
     70    echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] " 
     71    read answer 
     72    answer=`echo $answer | sed 's/^[y].*$/y/'` 
     73    if [  -z "$answer" -o "x$answer" = "xy" ]; then 
     74      # testing if configuration exists 
     75      if [ "$(cat ${CONFIG_DIR}/cfg.txt | grep "${NEW_CONF} ")"  == "" ] ; then 
     76        echo "The configuration ${NEW_CONF} does not exist in file cfg.txt"      
     77        echo "No removing configuration" 
     78        echo " " 
    7579        else 
    76       rm -rf ${CONFIG_DIR}/${NEW_CONF} 
    77       sed -e "/${NEW_CONF} /d"  ${CONFIG_DIR}/cfg.txt >  ${CONFIG_DIR}/cfg.tmp 
    78       mv  ${CONFIG_DIR}/cfg.tmp  ${CONFIG_DIR}/cfg.txt 
    79       echo "${NEW_CONF} configuration REMOVED"  
     80        rm -rf ${CONFIG_DIR}/${NEW_CONF} 
     81        sed -e "/${NEW_CONF} /d"  ${CONFIG_DIR}/cfg.txt >  ${CONFIG_DIR}/cfg.tmp 
     82        mv  ${CONFIG_DIR}/cfg.tmp  ${CONFIG_DIR}/cfg.txt 
     83        echo "${NEW_CONF} configuration REMOVED"  
    8084        fi 
    81  else 
    82    echo " " 
    83    echo "nothing to remove" 
    84  fi 
    85  
     85    else 
     86      echo " " 
     87      echo "nothing to remove" 
     88    fi 
     89 fi  
    8690 unset -v answer 
Note: See TracChangeset for help on using the changeset viewer.