mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
6faaa698e4
that are misinterpreted by echo(1) aren't. PR: docs/8757 Submitted By: Takeshi OHASHI <ohashi@mickey.ai.kyutech.ac.jp> Sergei Laskavy <laskavy@gambit.msk.su>
24 lines
544 B
Bash
24 lines
544 B
Bash
#!/bin/sh
|
|
#
|
|
# psif - Print PostScript or plain text on a PostScript printer
|
|
# Script version; NOT the version that comes with lprps
|
|
# Installed in /usr/local/libexec/psif
|
|
#
|
|
|
|
read first_line
|
|
first_two_chars=`expr "$first_line" : '\(..\)'`
|
|
|
|
if [ "$first_two_chars" = "%!" ]; then
|
|
#
|
|
# PostScript job, print it.
|
|
#
|
|
echo "$first_line" && cat && printf "\004" && exit 0
|
|
exit 2
|
|
else
|
|
#
|
|
# Plain text, convert it, then print it.
|
|
#
|
|
( echo "$first_line"; cat ) | /usr/local/bin/textps && printf "\004" && exit 0
|
|
exit 2
|
|
fi
|