/quote

Usage:

/QUOTE [-ddisp] [-w[world]] [-time] [pre] '"file"[suf]
/QUOTE [-ddisp] [-w[world]] [-time] [pre] !"shell cmd"[suf]
/QUOTE [-ddisp] [-w[world]] [-time] [pre] `"TF cmd"[suf]
/QUOTE [-ddisp] [-w[world]] [-time] [pre] #"recall cmd"[suf]


/Quote generates lines of text, one for each line quoted from a file, shell command, history, or TF command. This will be done at a rate described in the section "processes".

Options and arguments:

-ddisp
disposition of generated text. Disp is one of: "echo" (echo to the screen), "send" (send directly to the socket), or "exec" (execute text as a tf command). The default disp is "send" if there is no pre, and "exec" if there is a pre.
-wworld
Commands will be executed with world as the current world. If world is blank, it uses the world that was current when the /quote started. If -w is omitted, the command's current world will be whatever happens to be in the foreground when the command occurs. (See "sockets").
-time
The delay between each generated line. It can have the format "hh:mm:ss", "hh:mm", or "ss". If -time is omitted, the variable %{ptime} is used. If time is given as the letter "S", the quote will run synchronously with no delay (see "processes"). If a slow shell command is used with /quote -S !, tf will hang until the command produces some output or exits. A synchronous /quote may be used inside another /quote.
pre
pre is prefixed to each generated line. If pre contains any of the command characters ('!`#), they must be preceded with '\' to remove their special meaning.
'file
Get text from file. The file name is expanded as described under /help filenames.
!shell cmd
Get text from the standard output and standard error of executing shell cmd in the shell.
`tf cmd
Get text from the output of executing tf cmd in tf.
#recall cmd
Get text from executing a /recall command. (See "recall" for the exact syntax).
suf
suf is suffixed to each generated line. If omitted, the double quotes around the file or command may be omitted.

An asynchronous /quote returns the pid of the new process, or 0 if an error occurred. A synchronous shell or command quote returns the return value of the command. A synchronous file quote returns 0 on error, nonzero otherwise.

The library file quoter.tf defines some useful quoter commands that are shortcuts for some common uses of quote.

The following is a list of some nearly equivilent pairs of commands:

/quote -S -dexec 'file
/load file
/quote -S -decho #args
/recall args
/quote opts `/recall args
/quote opts #args


Examples:

  /quote -1 :reads about '"/usr/dict/words" in the dictionary.
This sends off lines like:
:reads about aardvark in the dictionary.
:reads about aardvore in the dictionary.
with one-second delays between lines.

  /quote -S /echo !ps -gux
This displays the output of the system command "ps -gux" by echoing it locally, immediately.

  /quote -0 :heard: #-wCave /2 *pages*
This sends off quickly:

:heard: [the last 2 lines from Cave that contain "pages"]

  /quote :is using `/version
will tell everybody in the room what version of TF you're running.

  /quote -wlpmud -dsend 'prog.c
will send the file "prog.c" to the world "lpmud" (without any interpretation of leading spaces, lines like "/* comment */", etc.)


See: processes, quoter.tf, history, command subs, /load, /recall, /sh, /sys


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997 Ken Keys