Integration in a DSS

! Date: Wed, 9 Aug 95 08:43:57 CDT
! From: Mike Bender <mike@ce.UManitoba.CA>
! Subject: Integration in a DSS
!
! I have been using Grass 4.1 on its own, using command line codes. I go
! through the normal prompting upon typing 'grass4.1 <Enter>' such as
! database and mapset. ...
!
! My question is how to start grass up without the interactive prompting
! for database and mapset?

A smart man introduced me to the unix program 'expect' (Tcl based) which
might suit your needs, at least to some degree. The blurb from the man
page reads:

    "Expect is a program that "talks" to other interactive pro-
     grams according to a script. Following the script, Expect
     knows what can be expected from a program and what the
     correct response should be. An interpreted language pro-
     vides branching and high-level control structures to direct
     the dialogue. In addition, the user can take control and
     interact directly when desired, afterward returning control
     to the script."

Below is a bit of script that uses expect commands to run r.support
providing grass with answers to all the prompts:

        #!/opt/bin/expect
         
        spawn /opt/grass/source/sun4/bin/r.support
        expect "*>*"
        send "$filename\n"
        expect {*[n]*}
        send "n\n"
        expect {*[n]*}
        send "y\n"
        expect {*[n]*}
        send "n\n"
        expect {*[n]*}
        send "y\n"
        expect {*>*}
        send "4\n"
        expect {*-->*}
        send "\n"
        expect {*[n]*}
        send "n\n"

I don't know where our copy came from, but I'm certain you can find it
from some anonymous ftp source. Hope this gives you some ideas.

Vida Jakabhazy
vida@aer.com