cs370:shrinkprint_script_q_and_a
Shrinkprint script Q & A
<== Back to shrinkprint project
- Q: Does the shell script have to be designed so that it somehow takes
textfile.txt
andhh305
as two parameters for use within the pipeline?- A: Yes,
textfile.txt
would be the first argument to the script, andhh305
would be the second argument to the script.
- Q: Does the text have to be printed in landscape or portrait format, or would either format be acceptable?
- A: Output of
shrinkprint
will always be landscape.Enscript
has options to set landscape or portrait orientation, but don't use those options when you callenscript
withinshrinkprint
.
- Q: After running the script, a prompt appears where
Ctrl+D
exits the prompt and the file is then printed. What's up?- A: If you're left with a prompt after running the script, it usually means you have an unterminated single or double quote in the script.
- Q: Does the line at the top containing the filename, the date/time, and the page number have to be removed somehow?
- A:
Enscript
puts thatfilename-date-time-page-number
information at the top of pages by default. Forceenscript
not to include that information.
- Q: Must the code have the ability to find other printers (such as
hh310
), or can it be assumed that the targeted printer is accessible.- A: Just assume that the targeted printer is accessible. If it's not, the script will just exit with an error from
lpr
and nothing will be printed. If you're working in HH 305, usehh305
. If you're working in HH 310, usehh310
.
- Q: When I call
shrinkprint
it doesn't recognize it as a command. What's up?- A: You need to make the
shrinkprint
script executable once with chmod +x shrinkprint, then either copy it to your ~/bin directory or run it with ./shrinkprint …
- Q:
Enscript
has a columns option that can duplicatepsnup's
functionality for the purposes of theshrinkprint
script. Should I use that option?- A: No, don't use that
enscript
option.
- Q: When I run my script, the printer gives me 1 page of correct output and then one page of what looks like postscript code. Where's this page of postscript code coming from?
- A:
Enscript
is sending its output directly to the printer, instead of piping output topsnup
as required. At the same time,psnup
is piping some of its output tolpr
, andlpr
is printing that page of postscript code. So, the page of actual output you're getting at the printer is fromenscript
, while the page of useless postscript you're getting is frompsnup … | lpr …
. The fix is to makeenscript
send its postscript output to standard output, so that the postscript will actually be piped topsnup
.
<== Back to shrinkprint project
cs370/shrinkprint_script_q_and_a.txt · Last modified: 2014/10/06 17:11 by jchung