Ignore:
Timestamp:
02/16/10 09:46:45 (14 years ago)
Author:
mmaipsl
Message:

Add a protection for cards : Try to read an section/option in a card before we write a new value.

If the section/option doesn't exist, the script will stop because it may be a bogue from the programmer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_card/libIGCM_card.ksh

    r96 r221  
    180180    if [ -r "$1" ] && [ -w "$1" ] ; then 
    181181        typeset tmpfile=tmpfile_$$ 
     182        ( IGCM_card_PrintOption "$1" "$2" "$3" | grep "not found" ) > ${tmpfile} 
     183        if [ $( cat ${tmpfile} | wc -l ) -gt 0 ] ; then 
     184            echo "-------------------------------------------" 
     185            echo "!!! Problem with IGCM_card_WriteOption !!!" 
     186            echo "Try to write : " $@ 
     187            echo "You have to correcte some script."  
     188            echo "We won't do anything else !" 
     189            exit 1 
     190        fi 
     191        rm ${tmpfile} 
    182192        ( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_WriteOption.awk -- "$@" 2> /dev/null ) > ${tmpfile} 
    183193        cp $1 $1.bak 
Note: See TracChangeset for help on using the changeset viewer.