d.rast.zoom3

Here is a modified version of the script d.rast.zoom2, we called it d.rast.zoom3
Most of the script was written by Rick Thompson and I did only a few modifacations to allow the display of up to 2 sites files, and I the checking if input is valid.

--------------BEGIN--------------------
#!/bin/sh

# *** d.rast.zoom3 ***
# Written by Rick Thompson
# modified by Ronnie Lassche. Provided options for color vector displays
# and site parameters for display.
#
# @(#) d.rast.zoom3: allows repetitive display and interactive d.zooming of up
# @(#) to 1 raster map, and 3 vector files,
# @(#) plus d.zooming back out in the reverse order. Additionally,
# @(#) a region can be saved, the original raster file's region
# @(#) can be returned to, or the user can do a one-time display
# @(#) of a new raster or vector file.
# @(#) Last revision: 7/15/94

# Recognize CDS echo -n
if [ `uname -m` = mips ] ; then
  ECHON="/usr/bsd43/bin/echo -n"
# Recognize Solaris 2.3 echo -n
elif [ `uname -s` = SunOS -a `uname -r | sed 's/\...*$//'` = 5 ] ; then
  ECHON="/usr/ucb/echo -n"
else
  ECHON="echo -n"
fi

if [ "$GISRC" = "" ] ; then
  clear
  echo "This command must be run from GRASS!"
  echo ''
  exit 1
fi

# name=''
clear
echo ''
echo "Option: Name of raster map "
echo " key: map"
echo "required: NO"
     g.ask type=old element=cell desc=raster unixfile=/tmp/$$
    . /tmp/$$
    rm -f /tmp/$$
    rast="$name"

echo ''
echo "Option: Name of vector map "
echo " key: map"
echo "required: NO"
  g.ask type=old element=dig desc=vector unixfile=/tmp/$$
  . /tmp/$$
  rm -f /tmp/$$
    vect="$name"

if [ -n "$vect" ] ; then

  gotit=0
  while test $gotit -eq 0
   do
    echo ""
    echo "Option: line color "
    echo " key: color"
    echo " Default: white"
    echo "required: NO"
    $ECHON "enter option > "
    read col1
     if test "$col1"
      then
       if test "$col1" != "aqua" -a "$col1" != "black" -a "$col1" != "blue" -a "$col1" != "brown" -a "$col1" != "gray" -a "$col1" != "green" -a "$col1" != "grey" -a "$col1" != "indigo" -a "$col1" != "magenta" -a "$col1" != "orange" -a "$col1" != "red" -a "$col1" != "white" -a "$col1" != "yellow"
        then
         echo ""
         echo "sorry <$col1> is not valid input"
         echo ""
         echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
         echo " magenta,orange,red,white,yellow"
        else
         gotit=1
       fi
      else
       col1=white
       gotit=1
     fi
   done

  echo ''
  echo "Option: Name of second vector map "
  echo " key: map"
  echo "required: NO"
      g.ask type=old element=dig desc=vector unixfile=/tmp/$$
      . /tmp/$$
      rm -f /tmp/$$
        vect2="$name"
fi

if [ -n "$vect2" ] ; then

gotit=0
while test $gotit -eq 0
do
  echo ""
  echo "Option: line color "
  echo " key: color"
  echo " Default: white"
  echo "required: NO"
  $ECHON "enter option > "
  read col2
   if test "$col2"
    then
     if test "$col2" != "aqua" -a "$col2" != "black" -a "$col2" != "blue" -a "$col2" != "brown" -a "$col2" != "gray" -a "$col2" != "green" -a "$col2" != "grey" -a "$col2" != "indigo" -a "$col2" != "magenta" -a "$col2" != "orange" -a "$col2" != "red" -a "$col2" != "white" -a "$col2" != "yellow"
     then
       echo ""
       echo "sorry <$col2> is not valid input"
       echo ""
       echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
       echo " magenta,orange,red,white,yellow"
      else
       gotit=1
     fi
    else
     col2=white
     gotit=1
   fi
done

echo ""
echo "Option: Name of third vector map "
echo " key: map"
echo "required: NO"
    g.ask type=old element=dig desc=vector unixfile=/tmp/$$
    . /tmp/$$
    rm -f /tmp/$$
      vect3="$name"

fi

if [ -n "$vect3" ] ; then

  gotit=0
  while test $gotit -eq 0
   do
    echo ""
    echo "Option: line color "
    echo " key: color"
    echo " Default: white"
    echo "required: NO"
    $ECHON "enter option > "
    read col3
     if test "$col3"
      then
       if test "$col3" != "aqua" -a "$col3" != "black" -a "$col3" != "blue" -a "$col3" != "brown" -a "$col3" != "gray" -a "$col3" != "green" -a "$col3" != "grey" -a "$col3" != "indigo" -a "$col3" != "magenta" -a "$col3" != "orange" -a "$col3" != "red" -a "$col3" != "white" -a "$col3" != "yellow"
        then
         echo ""
         echo "sorry <$col3> is not valid input"
         echo ""
         echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
         echo " magenta,orange,red,white,yellow"
        else
         gotit=1
       fi
      else
       col3=white
       gotit=1
     fi
   done
fi

echo ''
echo "Option: Name of sites file "
echo " key: file"
echo "required: NO"
  g.ask type=old element=site_lists desc=sites unixfile=/tmp/$$
  . /tmp/$$
  rm -f /tmp/$$
    sites="$name"

if [ -n "$sites" ] ; then

  gotit=0
  while test $gotit -eq 0
   do
    echo ""
    echo "Option: Sets the current color to that stated"
    echo " key: color"
    echo " Default: gray"
    echo "required: NO"
    $ECHON "enter option > "
    read col4
     if test "$col4"
      then
       if test "$col4" != "aqua" -a "$col4" != "black" -a "$col4" != "blue" -a "$col4" != "brown" -a "$col4" != "gray" -a "$col4" != "green" -a "$col4" != "grey" -a "$col4" != "indigo" -a "$col4" != "magenta" -a "$col4" != "orange" -a "$col4" != "red" -a "$col4" != "white" -a "$col4" != "yellow"
        then
         echo ""
         echo "sorry <$col4> is not valid input"
         echo ""
         echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
         echo " magenta,orange,red,white,yellow"
        else
         gotit=1
       fi
      else
       col4=gray
       gotit=1
     fi
   done

  gotit=0
   while test $gotit -eq 0
   do
    echo ""
    echo "Option: Size, in pixels, in wich the icon is to be drawn"
    echo " key: size"
    echo " Default: 5"
    echo "required: NO"
    $ECHON "enter option > "
    read size
      if test "$size"
       then
        if test $size -le 0
         then
          echo ""
          echo "sorry <$size> is not valid input"
          echo ""
          echo "size must be greater then 0"
          echo ""
         else
          gotit=1
        fi
       else
        size=5
        gotit=1
      fi
   done

  gotit=0
   while test $gotit -eq 0
   do
    echo ""
    echo "Option: Specify the type of the icon"
    echo " key: type (+,diamond.box,x)"
    echo " Default: x"
    echo "required: NO"
    $ECHON "enter option > "
      read icon
       if test "$icon"
        then
         if test "$icon" != "+" -a "$icon" != "diamond" -a "$icon" != "box" -a "$icon" != "x"
          then
           echo ""
           echo "sorry <$icon> is not valid input"
           echo ""
           echo "Options : +,diamond,box,x"
           echo ""
          else
           gotit=1
         fi
        else
         icon=x
         gotit=1
       fi
   done

echo ''
echo "Option: Name of second sites file "
echo " key: file"
echo "required: NO"
  g.ask type=old element=site_lists desc=sites unixfile=/tmp/$$
  . /tmp/$$
  rm -f /tmp/$$
    sites2="$name"

fi
if [ -n "$sites2" ] ; then

  gotit=0
  while test $gotit -eq 0
   do
    echo ""
    echo "Option: Sets the current color to that stated"
    echo " key: color"
    echo " Default: gray"
    echo "required: NO"
    $ECHON "enter option > "
    read col5
     if test "$col5"
      then
       if test "$col5" != "aqua" -a "$col5" != "black" -a "$col5" != "blue" -a "$col5" != "brown" -a "$col5" != "gray" -a "$col5" != "green" -a "$col5" != "grey" -a "$col5" != "indigo" -a "$col5" != "magenta" -a "$col5" != "orange" -a "$col5" != "red" -a "$col5" != "white" -a "$col5" != "yellow"
        then
         echo ""
         echo "sorry <$col5> not valid input"
         echo ""
         echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
         echo " magenta,orange,red,white,yellow"
        else
         gotit=1
       fi
      else
       col5=gray
       gotit=1
     fi
   done

  gotit=0
   while test $gotit -eq 0
   do
    echo ""
    echo "Option: Size, in pixels, in wich the icon is to be drawn"
    echo " key: size"
    echo " Default: 5"
    echo "required: NO"
    $ECHON "enter option > "
    read size2
      if test "$size2"
       then
        if test $size2 -le 0
         then
          echo ""
          echo "sorry <$size2> is not valid input"
          echo ""
          echo "size must be greater then 0"
          echo ""
         else
          gotit=1
        fi
       else
        size2=5
        gotit=1
      fi
   done

  gotit=0
   while test $gotit -eq 0
   do
    echo ""
    echo "Option: Specify the type of the icon"
    echo " key: type (+,diamond.box,x)"
    echo " Default: x"
    echo "required: NO"
    $ECHON "enter option > "
      read icon2
       if test "$icon2"
        then
         if test "$icon2" != "+" -a "$icon2" != "diamond" -a "$icon2" != "box" -a "$icon2" != "x"
          then
           echo ""
           echo "sorry <$icon2> is not valid input"
           echo ""
           echo "Options : +,diamond,box,x"
           echo ""
          else
           gotit=1
         fi
        else
         icon2=x
         gotit=1
       fi
   done

echo ''

fi

d.erase
g.region rast="$rast"

if [ -f $LOCATION/cell/"$rast" ] ; then
  d.rast "$rast"
fi

if [ -n "$vect" ] ; then
  d.vect "$vect" c=$col1
fi

if [ -n "$vect2" ] ; then
  d.vect "$vect2" c=$col2
fi

if [ -n "$vect3" ] ; then
  d.vect "$vect3" c=$col3
fi

if [ -n "$sites" ] ; then
  d.sites "$sites" color=$col4 size=$size type=$icon
fi

if [ -n "$sites2" ] ; then
  d.sites "$sites2" color=$col5 size=$size2 type=$icon2
fi

g.region save=rastzoomtmp1
response="y"
i=1
until [ "$response" = "n" -o "$response" = "N" ] ; do
  clear
  echo ''
  echo "Please select one of these actions to:"
  echo ''
  echo "1 - use the interactive d.zoom"
  echo "2 - go to the previous zoom"
  echo "3 - go to a designated region"
  echo "4 - return to <$rast>""'s"" region"
  echo "5 - save the current region"
  echo "6 - do a one time display of a new raster map"
  echo "7 - do a one time display of a new vector map"
  echo "8 - quit"
  echo ''
  $ECHON "Please enter the appropriate number: "
  read number
  case $number in
  1) i=`expr $i + 1`
     d.zoom -q
     g.region save=rastzoomtmp$i
     d.erase

           if [ -f $LOCATION/cell/"$rast" ] ; then
             d.rast "$rast"
           fi

     if [ -n "$vect" ] ; then
       d.vect "$vect" c=$col1
     fi

     if [ -n "$vect2" ] ; then
       d.vect "$vect2" c=$col2
           fi

     if [ -n "$vect3" ] ; then
       d.vect "$vect3" c=$col3
     fi

           if [ -n "$sites" ] ; then
             d.sites "$sites" color=$col4 size=$size type=$icon
           fi

           if [ -n "$sites2" ] ; then
             d.sites "$sites2" color=$col5 size=$size2 type=$icon2
           fi;;

  2) i=`expr $i - 1`
     if [ $i = 0 ] ; then
       echo "No previous zooming windows remain. Would you like to view"
       $ECHON "the default region? (y/n) "
       read ans
       if [ "$ans" = "y" -o "$ans" = "Y" ] ; then
         g.region -d res=$res
         d.erase
               if [ -f $LOCATION/cell/"$rast" ] ; then
           d.rast "$rast"
               fi
       fi

       if [ -n "$vect" ] ; then
         d.vect "$vect" c=$col1
       fi

       if [ -f "$vect2" ] ; then
         d.vect "$vect2" c=$col2
       fi

       if [ -f "$vect3" ] ; then
         d.vect "$vect3" c=$col3
       fi
  
             if [ -n "$sites" ] ; then
               d.sites "$sites" color=$col4 size=$size type=$icon
             fi

             if [ -n "$sites2" ] ; then
               d.sites "$sites2" color=$col5 size=$size2 type=$icon2
             fi

     elif [ $i -lt 0 ] ; then
       echo ''
       echo "No previous zooming windows remain."
       echo ''
       sleep 3
     else
       g.region region=rastzoomtmp$i
       d.erase
             if [ -f $LOCATION/cell/"$rast" ] ; then
         d.rast "$rast"
             fi

       if [ -n "$vect" ] ; then
         d.vect "$vect" c=$col1
       fi

       if [ -n "$vect2" ] ; then
         d.vect "$vect2" c=$col2
       fi

       if [ -n "$vect3" ] ; then
         d.vect "$vect3" c=$col3
       fi

             if [ -n "$sites" ] ; then
               d.sites "$sites" color=$col4 size=$size type=$icon
             fi

             if [ -n "$sites2" ] ; then
               d.sites "$sites2" color=$col5 size=$size2 type=$icon2
             fi

     fi;;

  3) echo ''
      echo 'The region is based on:'
     echo ''
     echo '1 - raster file'
     echo '2 - vector file'
     echo '3 - region file'
     echo ''
     $ECHON 'Please enter the appropriate number: '
      read regno
     case $regno in
    1) echo ''
       type="rast";;
    2) echo ''
       type="vect";;
    3) echo ''
       type="region";;
     esac
     g.list "$type"
      echo ''
     $ECHON "Enter the $type region you want: "
     read newreg
     g.region "$type"="$newreg"
     d.erase

           if [ -f $LOCATION/cell/"$rast" ] ; then
       d.rast "$rast"
           fi

     if [ -n "$vect" ] ; then
       d.vect "$vect" c=$col1
     fi

     if [ -n "$vect2" ] ; then
       d.vect "$vect2" c=$col2
     fi

     if [ -n "$vect3" ] ; then
       d.vect "$vect3" c=$col3
     fi

           if [ -n "$sites" ] ; then
             d.sites "$sites" color=$col4 size=$size type=$icon
           fi

           if [ -n "$sites2" ] ; then
             d.sites "$sites2" color=$col5 size=$size2 type=$icon2
           fi;;

  4) g.region rast="$rast"
     d.erase

           if [ -f $LOCATION/cell/"$rast" ] ; then
       d.rast "$rast"
           fi

     if [ -n "$vect" ] ; then
       d.vect "$vect" c=$col1
     fi

     if [ -n "$vect2" ] ; then
       d.vect "$vect2" c=$col2
     fi

     if [ -n "$vect3" ] ; then
       d.vect "$vect3" c=$col3
     fi

           if [ -n "$sites" ] ; then
             d.sites "$sites" color=$col4 size=$size type=$icon
           fi

           if [ -n "$sites2" ] ; then
             d.sites "$sites2" color=$col5 size=$size2 type=$icon2
           fi;;

  5) echo ''
     $ECHON "Enter the name by which to save this region: "
     read nreg
     g.region save=$nreg;;
  6) echo ''
     g.ask type=mapset prompt="Please select the tmp raster map:" element=cell desc=raster unixfile=/tmp/$$
       . /tmp/$$
     rm -f /tmp/$$
       rname="$name"
       name=''
       d.rast -o "$rname";;
  7) echo ''
     g.ask type=mapset prompt="Please select the tmp vector map:" element=dig desc=vector unixfile=/tmp/$$
       . /tmp/$$
     rm -f /tmp/$$
       vname="$name"
       name=''
       echo ''
  gotit=0
  while test $gotit -eq 0
   do
    echo ""
    echo "Option: line color "
    echo " key: color"
    echo " Default: white"
    echo "required: NO"
    $ECHON "enter option > "
    read vnamcol
     if test "$vnamcol"
      then
       if test "$vnamcol" != "aqua" -a "$vnamcol" != "black" -a "$vnamcol" != "blue" -a "$vnamcol" != "brown" -a "$vnamcol" != "gray" -a "$vnamcol" != "green" -a "$vnamcol" != "grey" -a "$vnamcol" != "indigo" -a "$vnamcol" != "magenta" -a "$vnamcol" != "orange" -a "$vnamcol" != "red" -a "$vnamcol" != "white" -a "$vnamcol" != "yellow"
        then
         echo ""
         echo "sorry <$vnamcol> is not valid input"
         echo ""
         echo "Options : aqua,black,blue,brown,gray,green,grey,indigo,"
         echo " magenta,orange,red,white,yellow"
        else
         gotit=1
       fi
      else
       vnamcol=white
       gotit=1
     fi
   done
       d.vect "$vname" c=$vnamcol;;

  8) rm $LOCATION/windows/rastzoomtmp*
     exit 0;;
esac
done
rm $LOCATION/windows/rastzoomtmp*
------------------END-----------
***********************************************
* Ronnie Lassche *
* Department of earth sciences *
* Free University *
* Amsterdam *
* lasm@geo.vu.nl *
***********************************************