From owner-freebsd-questions Tue May 20 16:17:43 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id QAA03982 for questions-outgoing; Tue, 20 May 1997 16:17:43 -0700 (PDT) Received: from punt-2.mail.demon.net (relay-11.mail.demon.net [194.217.242.137]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id QAA03970 for ; Tue, 20 May 1997 16:17:34 -0700 (PDT) Received: from cyberworld.demon.co.uk ([158.152.125.109]) by punt-2.mail.demon.net id aa1000736; 20 May 97 22:47 BST Message-ID: <33821BD5.BC4BBF04@cyberworld.demon.co.uk> Date: Tue, 20 May 1997 22:47:02 +0100 From: Lee Johnston X-Mailer: Mozilla 4.0b3 [en] (Win95; I) MIME-Version: 1.0 To: questions@freebsd.org Subject: Printing using FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=iso-8859-1 Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I am using FreeBSD 2.1.6 with a non postscript printer (a Canon BJC-4100 Bubble Jet simulating a Epson LQ). I have managed to get ghostscript to printout a .ps file on the printer, but when I create a printer filter that is included in the FreeBSD handbook, which is shown below, it doesn't work! #!/bin/sh # # ifhp - Print Ghostscript-simulated PostScript on a Canon BJC-4100 # Installed in /usr/local/libexec/hpif # # Treat LF as CR+LF: # printf "\033&k2G" || exit 2 # # Read first two characters of the file # read first_line first_two_chars=`expr "$first_line" : '\(..\)'` if [ "$first_two_chars" = "%!" ]; then # # It is PostScript; use Ghostscript to scan-convert and print it # /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=epsonc -sOutputFile=- - \ && exit 0 else # # Plain text or HP/PCL, so just print it directly; print a form # at the end to eject the last page. # echo $first_line && cat && printf "\f" && exit 2 fi exit 2 I suspect that it may be the line ' first_two_chars=`expr "$first_line" : '\(..\)'` ' as when I try a simple filter shown below, to echo the result of the ' first_two_chars=`expr "$first_line" : '\(..\)'` ' line to the printer, if only prints out ' expr "$first_line" : '\(..\)' '. #!/bin/sh read first_line first_two_chars=`expr "$first_line" : '\(..\)'` echo $first_two_chars && exit 0 exit 2 Has anyone come across this problem, and how do I solve it, Thanks! ______ Lee Johnston ljohnston@cyberworld.demon.co.uk http://www.cyberworld.demon.co.uk