[GRASS-user] g.parser inside g.parser

Hi all,
We just created a script that creates another script.
I'll try to explain:

suppose we have a big text file (init.file) organized like that
_______________________________
parameter1 parameter2
0.3 0.9

parameter3 parameter4
1000 1

.... .....
_______________________________

but really more complex ....

we have just created a script (script1.sh) like this
(pseudocode)

____________________________________________________

#!/bin/bash
#%Module
#% description: description
#% keywords: blah
#%End
#%option
#% key: initfile
#% gisprompt: string
#% type: string
#% description: initfile
#% required : yes
#%end
if [ "$1" != "@ARGS_PARSED@" ] ; then
  exec g.parser "$0" "$@"
fi
- read the passed init.file
- parse the existing init.file and assign each parameter value to a
different variable
- echo "
  #!/bin/bash
  #%Module
  #% description: description
  #% keywords: raster
  #%End
  #%option
  #% key: param1
  #% gisprompt: string
  #% type: string
  #% description: DEM
  #% required : yes
  #% answer: first_variable_parsed_from_init.file
  #%end
  ....

  if [ "$1" != "@ARGS_PARSED@" ] ; then
      exec g.parser "$0" "$@"
  fi

  ./another_fortran_code param1=something param2=something .....
" > script2.sh
./script2.sh
_____________________________________________________

if we execute the script1 from command line

./script1.sh initfile=init.file

a new gui windows is opened from the execution of the script2.sh

but when we simply run

./script1.sh

the first gui window starts, we fill the form concerning the initfile
key, and then we click run, the second gui window (that produced by
script2.sh) doesn't start.

It seems a problem related to g.parser but we can't understand how to
solve it...

any help is really apreciated...

Thanks...

Ivan

--
Ti prego di cercare di non inviarmi files .dwg, .doc, .xls, .ppt.
Preferisco formati liberi.
Please try to avoid to send me .dwg, .doc, .xls, .ppt files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format

Ivan Marchesini
Perugia (Italy)
Socio fondatore GFOSS "Geospatial Free and Open Source Software" http://www.gfoss.it
e-mail: ivan.marchesini@irpi.cnr.it
        ivan.marchesini@gmail.com
fax (mailfax): +39 1782092534
jabber: geoivan73@jabber.org
skype: geoivan73