groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about groff file


From: Ingo Schwarze
Subject: Re: Question about groff file
Date: Wed, 1 Apr 2020 04:25:49 +0200
User-agent: Mutt/1.12.2 (2019-09-21)

Salut Gregoire,

Gregoire Babey wrote on Wed, Apr 01, 2020 at 03:55:24AM +0200:

> I reading the manual again.
> There is something I don't understand.
> I read in the manual, at chap. 2.6:
> 
> "groff file
> 
> This command processes file without a macro package or a preprocessor.
> The output device is the default, ‘ps’, and the output is sent to
> stdout."
> 
> I tried this with a simple file named aa, containing only two
> characters. "aa". If I type:
> 
> groff aa
> 
> I should find at some place a file named aa.ps.

No, absolutely not.  You didn't read carefully enough.  It says:

  "the output is sent to stdout"

and that's what it does:

  schwarze@isnote $ echo 'input text' > aa 
  schwarze@isnote $ groff aa | head -n 5   
  %!PS-Adobe-3.0
  %%Creator: groff version 1.22.4
  %%CreationDate: Wed Apr  1 04:07:41 2020
  %%DocumentNeededResources: font Times-Roman
  %%DocumentSuppliedResources: procset grops 1.22 4
  schwarze@isnote $ 

You see the generated PostScript code right there, on standard output,
on your terminal.  See the "%!PS-Adobe-3.0"?  That's the magic saying
"This is the beginning of a PostScript program."

If you want to redirect standard output to a file, you can use your
shell to do that:

  schwarze@isnote $ groff aa > aa.ps       
  schwarze@isnote $ head -n 5 aa.ps
  %!PS-Adobe-3.0
  %%Creator: groff version 1.22.4
  %%CreationDate: Wed Apr  1 04:11:18 2020
  %%DocumentNeededResources: font Times-Roman
  %%DocumentSuppliedResources: procset grops 1.22 4
  schwarze@isnote $

> But there is nothing.  I was searching with locate:
> locate aa.ps
> gives no results.

Even if you create aa.ps somewhere, locate(1) will only find it
after the next run of locate.updatedb(8) or a similar program;
when that will be depends on your operating system and configuration,
but typically not before the next day, maybe not even before the
next week.


Since you didn't know what standard output is, you might profit
from reading an introductory book about UNIX for beginners.

Or, if you want to see the real definition of stdout in POSIX (the
UNIX standard), here it is:

  https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html

This is a bit more detailed, but also not overly accessible for
beginners:

  https://man.openbsd.org/stdio.3

Yours,
  Ingo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]