[GRASSGUI] Re: grassgui Digest, Vol 4, Issue 6
Glynn Clements
glynn at gclements.plus.com
Sun Jun 10 16:18:26 EDT 2007
Michael Barton wrote:
> The file= option would be most useful for users directly accessing the
> command.
>
> > An alternative is to add stdin= and stdout= pseudo-options to the
> > module's GUI dialog, so that the user can redirect stdin/stdout of any
> > command from/to a file. This can be done in addition to a file= option
> > for modules where it would be useful.
> >
>
> Within a GUI environment, I'd like to be able to send these (and some other
> commands a set of rules stored in a variable, so that I don't have to save
> them to a tmp file and do the equivalent of...
>
> cat [file] | r.recode input=[map] output=[map]
>
> I'd rather do the equivalent of ...
>
> echo $rules > r.recode input=[map] output=[map]
This is meaningless; the RHS of the ">" operator has to be a filename.
If you don't want to use a temporary file, use stdin, i.e.:
echo "$rules" | r.recode input=[map] output=[map]
The other alternative would be to pass the rules as an argument, e.g.:
r.recode input=[map] output=[map] rules="`echo $rules`"
However, a long list of rules could easily overflow the maximum length
of a command line (which may be as low as 1Kb on some platforms).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-gui
mailing list