The WriteFile and AppendFile commands are used to redirect output to a file. When the output is directed to a file, it is not echoed to the screen. The WriteFile command takes one parameter which is either a filename or the built-in Darwin name terminal. If the parameter is a filename (or a filename preceded by path information), then all subsequent output is directed into this file. If the parameter is the built-in name terminal, then all subsequent output is directed towards the standard output. This is typically the terminal.
> WriteFile('book.tex'); # subsequent output is sent > lprint('A quick way to make a lot'); # to file book.tex > lprint('of work for myself.); > WriteFile(terminal); # redirect output to terminalThe WriteFile command creates a new file book.tex if no file book.tex exists. If book.tex already exists, it is removed and a new file with the same name is created.
The AppendFile command is identical to the WriteFile command except that it appends all subsequent output from Darwin to the end of the specified file. If no file exists, a new file is created.