Article View: comp.text
Article #3953Re: Need help with the .! troff request
From: Jay Plett
Date: Wed, 19 Aug 1987 17:59
Date: Wed, 19 Aug 1987 17:59
34 lines
2100 bytes
2100 bytes
In article <501@houxs.UUCP>, daw@houxs.UUCP (D.WOLVERTON) writes:
> I am unable to get the .! request to function successfully ...
> As a test case, the following file:
> This is a test of the .! troff capability.
> .! echo "This is only a test."
> ... my documentation states that the format for this request is
> .! cmd args The UNIX command cmd is executed and its output
> is interpolated at this point. The standard input
--------- wrong? --------->^^^^^^^^^^^^^^^^^^^^^^^^^^
> for cmd is closed.
The ".!" request, aka ".sy", was added to [nt]roff with the Device-
Independent troff modifications. For all versions of ditroff I have
seen, the above documentation is wrong. The output of "cmd" is NOT
interpolated, it merely goes to stdout (whatever that might mean for
any particular invocation of troff). To get what you expect, modify
your input file as follows:
This is a test of the .! troff capability.
.! echo "This is only a test." > /tmp/tx\n($$
.so /tmp/tx\n($$
.! rm /tmp/tx\n($$
What actually happens is that any blanks after ".!" are skipped, then
everything up to the end of the line is passed to the "system" library
function which should exec "sh -c [your line]". The line may contain
anything that you could type to a shell prompt, including pipes,
redirection and shell expansions or substitutions. [nt]roff escapes
WILL be interpreted before passing the line to a subshell.
--
Jay Plett
UUCP: {cmcl2,ihnp4}!lanl!unm-la!jay
{ucbvax,gatech}!unmvax!unm-la!jay
ARPA: jxyp@lanl.gov
Technical Details
Message-ID:
<663@unm-la.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!beta!unm-la!jayReferences:
<501@houxs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!beta!unm-la!jay From: jay@unm-la.UUCP (Jay Plett) Newsgroups: comp.text Subject: Re: Need help with the .! troff request Message-ID: <663@unm-la.UUCP> Date: Wed, 19-Aug-87 13:59:59 EDT Article-I.D.: unm-la.663 Posted: Wed Aug 19 13:59:59 1987 Date-Received: Sat, 22-Aug-87 02:09:23 EDT References: <501@houxs.UUCP> Organization: University of New Mexico - Los Alamos Lines: 34 Summary: Capturing output from [nt]roff shell escapes