Other named files: $Echo, $Offecho, $Onecho

Top  Previous  Next

Messages to any named file can be written using $Echo, $Onecho and $Offecho.  The $Echo sends one line and is invoked using the syntax

 

$echo 'text to be sent' > externalfile

or

$echo 'text to be sent' >> externalfile

 

where external file can be of unlimited length.

For multi line messages

 

$onecho  > externalfile

line 1 of text to be sent

line 2 of text to be sent

...

last line of text to be sent

$offecho

Notes:

Both the text and the file name can be quoted or unquoted.
The file name by default will go in the working directory.
The file is not closed until the end of the compilation or when a $call or any kind of $include statement is encountered.
The redirection symbols > causes any files with the same name to be overwritten.
The redirection symbols >> causes any files with the same name to be appended to.
An example is at bottom of condcomp.gms.
One can also use echo to display environment variables as discussed above.