Re: how to write this simple script command?



On Jan 31, 9:29 am, www <w...@xxxxxxxxxx> wrote:
Hi,

I want to write a script doing 3 shell commands in one time. I keep
forgetting on how to take the argument. Could you help me?

What I really want to do is:

1)print a file into a postscirpt file using a2ps:

a2ps --output=temp.ps the_file_name //this will generate temp.ps file

2)convert temp.ps to pdf file

ps2pdf temp.ps //this will generate temp.ps.pdf file

3)remove temp.ps

rm temp.ps

I hope to have one command to do all the three things. This command
takes one argument, which is the file name. It would be even better if
the argument is foo.txt and the final product is foo.txt.pdf, if the
argument is bar.txt and the final product is bar.txt.pdf.

Thank you for your help.

begin sample script a2pdf

#!/bin/bash
# Usage: a2pdf path-to-text-file
rm -f temp.ps
a2ps --output=temp.ps $1
ps2pdf temp.ps
rm -f temp.ps

end sample script a2pdf
.



Relevant Pages

  • Re: PDF Generation from scans
    ... A friend of mine checked out the following command ... for Linux using Ghostscript tooling: ... $ ps2pdf file.ps file_new.pdf ...
    (comp.periphs.scanners)
  • make Distiller honor EPS bounding box?
    ... I used to use ps2pdf with the -EPSCrop option ... to get PDFs that were properly cropped. ... What is the Distiller equivalent? ... (from the command line). ...
    (comp.lang.postscript)
  • Re: [opensuse] Printing to PDF from Firefox - Something Broke
    ... I ended up with a useless postscript file. ... When I could only save as postscript from Firefox I used to use the ... `ps2pdf` command to convert them. ...
    (SuSE)