Rebol Programming/echo

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

ECHO target 

DESCRIPTION:[edit | edit source]

Copies console output to a file.

ECHO is a function value.

ARGUMENTS[edit | edit source]

  • target -- (Type: file none logic)

(SPECIAL ATTRIBUTES)[edit | edit source]

  • catch

SOURCE CODE[edit | edit source]

echo: func [
    "Copies console output to a file." 
    target [file! none! logic!]
    if port? system/ports/echo [
        close system/ports/echo 
        system/ports/echo: none
    if target = true [target: %rebol-echo.txt] 
    if file? target [
        system/ports/echo: throw-on-error [open/write/new/direct target]