/quote
Usage:
/QUOTE [options] [pre] '"file"[suf]
/QUOTE [options] [pre] #"recall_args"[suf]
/QUOTE [options] [pre] !"shell_cmd"[suf]
/QUOTE [options] [pre] `"TF_cmd"[suf]
/Quote generates lines of text, one
for each line quoted from a file, shell command,
history, or TF command.
Each generated line is then echoed, sent to a socket, or executed as
a command.
Lines will be generated 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
- Generated 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, each command's
current world will be
whatever happens to be in the
foreground
when each command occurs.
(See "sockets").
- -time
- The delay between each generated line. It can have the format
"hours:minutes:seconds",
"hours:minutes", or "seconds",
and seconds may be specified to the nearest microsecond.
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.
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.
If time is given as the letter "P", the quote will run
whenever a prompt is received.
See "processes" for more
information on process timing.
- -ssub
- Expand TF_cmd as if
%{sub} were set
to sub.
By default, /quote
expands TF_cmd as if
%{sub}
were "full".
- 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_args
- Get text from executing
/recall
recall_args
. (See
"recall" for the exact syntax).
- suf
- Append suf to each generated line. If omitted,
the double quotes around the file or command may
also be omitted.
An asynchronous (background) /quote
(i.e., a
/quote without -S) returns the pid
of the new process, or 0 if an
error occurred. A synchronous (-S) 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 equivalent pairs of commands:
- /quote -S -dexec 'file
- /load file
- /quote -S /echo -aG - #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 or slashes (in lines like "/* comment */"),
etc.)
See: processes,
%ptime,
%lpquote,
quoter.tf,
history,
command subs,
/load,
/recall,
/sh,
/sys,
/paste
Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys