[GRASS-user] Re: r.finder

I recently published a grass script for focussing surveys. The name is r.finder, hoping it can be of help for somebody…

Augusto, great news :slight_smile: I’ll test it in my geomorphological work surely. You would not want to add it to GRASS-Addons wiki page (http://grass.osgeo.org/wiki/GRASS_AddOns)?

One note: in GRASS shell scripts it’s usually better to use:

– module <g.message> instead of standard “echo”

– special temp files (made with g.tempfile):


# create temporary file
TMP1="$(g.tempfile pid=$$)"
if [ "$?" -ne 0 ] || [ -z "$TMP1" ] ; then

    g.message -e "ERROR: Unable to create temporary files."
    exit 1
fi

– cleanup function and some actions for the case of user exit


############################################################
cleanup()
{ 
    g.mremove -f vect=MY_TEMP_VECTOR --q

    rm -f $TMP1*
    
}
############################################################

## what to do in case of user break:
exitprocedure()
{
    echo "User break!"

    cleanup
    exit 1
}

## shell check for user break (signal list: trap -l)

trap "exitprocedure" 2 3 15