REBOL Programming/echo

From Wikibooks, open books for an open world
< REBOL Programming
Jump to: navigation, search

USAGE:[edit]

ECHO target 

DESCRIPTION:[edit]

Copies console output to a file.

ECHO is a function value.

ARGUMENTS[edit]

  • target -- (Type: file none logic)

(SPECIAL ATTRIBUTES)[edit]

  • catch

SOURCE CODE[edit]

echo: func [
    "Copies console output to a file." 
    [catch] 
    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]
    ]
]