🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.sources.bugs
Article #911

Re: Neat little alias & technique to facilite troff

#911
From: Gary Puckering
Date: Wed, 21 Jan 1987 15:46
33 lines
1720 bytes
In article <920@houxu.UUCP> jhv@houxu.UUCP writes:
>My approach is to use the shell's "here-document" capability, putting the
>command line  to format the document as the first line of the document, and
>executing the file when I need processed output, for example (to include
>tbl, eqn, and pic preprocessors and to print the output on an Imagen
>printer):
>	tbl <<!EOF | eqn | pic | troff -mm | ipr -ltroff
>	...
>	!EOF
>Then either make the file executable with chmod, or type sh filename to get
>the formatted output.

Neat idea.  I like it.  One problem though -- how do you allow for both
printed output and terminal output.  So, I fiddled for awhile and got
this to work:

     if test "$1" = -p 
     then
     	roff="ptroff -ms"
     else
     	roff="nroff -ms | more"
     fi
     echo $roff
     eval $roff <<!EOF
     ...
     !EOF

Run this through sh and it will nroff to the terminal.  Add the -p
parameter and it will ptroff to the printer.
-- 
Gary Puckering        3755 Riverside Dr.
Cognos Incorporated   Ottawa, Ontario
(613) 738-1440        CANADA  K1G 3N3
Technical Details
Message-ID: <320@cognos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!cognos!garyp
References: <595@cubsvax.UUCP> <920@houxu.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site cognos.UUCP
Path: arc1-ca.pugleaf.net!utzoo!dciem!nrcaer!cognos!garyp
From: garyp@cognos.UUCP (Gary Puckering)
Newsgroups: net.sources.bugs
Subject: Re: Neat little alias & technique to facilite troff
Message-ID: <320@cognos.UUCP>
Date: Wed, 21-Jan-87 10:46:16 EST
Article-I.D.: cognos.320
Posted: Wed Jan 21 10:46:16 1987
Date-Received: Thu, 22-Jan-87 06:53:29 EST
References: <595@cubsvax.UUCP> <920@houxu.UUCP>
Reply-To: garyp@cognos.UUCP (Gary Puckering)
Organization: Cognos Inc., Ottawa, Canada
Lines: 33