Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   NZ Computing (http://www.velocityreviews.com/forums/f47-nz-computing.html)
-   -   Running Ghostscript quietly (http://www.velocityreviews.com/forums/t585898-running-ghostscript-quietly.html)

Lawrence D'Oliveiro 01-20-2008 04:22 AM

Running Ghostscript quietly
 
I've been trying to invoke gs from within a script without it printing extra
messages. According to the man page, "-q" turns off normal messages,
while "-dNOPAUSE" also turns off the prompting at the end of each output
page.

As far as I can tell, "-dNOPAUSE" simply does not work. For example, I try
to use the following command to list all fonts known to the interpreter:

gs -q -dNOPAUSE <<<"(*) {=} 255 string /Font resourceforall"

but the output looks like this:

GS>URWPalladioL-BoldItal
... other fonts ...
Palatino-Italic
GS>

I can't seem to get rid of those useless "GS>" prompts.

In the end, the best I could come up with was 1) add an extra blank line at
the front of the PostScript output, so the initial "GS>" ends up on a line
by itself, and 2) use "head" and "tail" commands to get rid of the lines
containing the "GS>" prompts:

gs -q <<<"() = (*) {=} 255 string /Font resourceforall" \
| tail -n+2 | head -n-1 | sort

By the way, I checked the effect of "-dQUIET", and that does work.

Ross 01-20-2008 08:56 AM

Re: Running Ghostscript quietly
 
On Sun, 20 Jan 2008 17:22:44 +1300, Lawrence D'Oliveiro
<ldo@geek-central.gen.new_zealand> wrote:

>I've been trying to invoke gs from within a script without it printing extra
>messages. According to the man page, "-q" turns off normal messages,
>while "-dNOPAUSE" also turns off the prompting at the end of each output
>page.
>
>As far as I can tell, "-dNOPAUSE" simply does not work. For example, I try
>to use the following command to list all fonts known to the interpreter:
>
> gs -q -dNOPAUSE <<<"(*) {=} 255 string /Font resourceforall"
>
>but the output looks like this:
>
> GS>URWPalladioL-BoldItal
> ... other fonts ...
> Palatino-Italic
> GS>
>
>I can't seem to get rid of those useless "GS>" prompts.
>
>In the end, the best I could come up with was 1) add an extra blank line at
>the front of the PostScript output, so the initial "GS>" ends up on a line
>by itself, and 2) use "head" and "tail" commands to get rid of the lines
>containing the "GS>" prompts:
>
> gs -q <<<"() = (*) {=} 255 string /Font resourceforall" \
> | tail -n+2 | head -n-1 | sort
>
>By the way, I checked the effect of "-dQUIET", and that does work.


I don't suppose > NUL works... as in batch files?

Lawrence D'Oliveiro 01-20-2008 10:14 AM

Re: Running Ghostscript quietly
 
In message <fmuiak$3qp$1@lust.ihug.co.nz>, Lawrence D'Oliveiro wrote:

> As far as I can tell, "-dNOPAUSE" simply does not work.


The following command line produces the right output, without the need for
all the "head" and "tail" and extra-line stuff:

gsnd -q -dBATCH /dev/stdin \
<<<"(*) {=} 255 string /Font resourceforall" | sort


All times are GMT. The time now is 10:52 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.