added more options for printers - if none fount it should output to stdout
parent
e295910234
commit
c89e1e01ac
|
|
@ -6,7 +6,24 @@
|
||||||
# Env: PRINTER_DEV - printer device node (default: /dev/lp0)
|
# Env: PRINTER_DEV - printer device node (default: /dev/lp0)
|
||||||
|
|
||||||
infile="${1:-ascii-img.txt}"
|
infile="${1:-ascii-img.txt}"
|
||||||
|
# Source - https://stackoverflow.com/a/638980
|
||||||
|
# Posted by John Feminella, modified by community. See post 'Timeline' for change history
|
||||||
|
# Retrieved 2026-07-14, License - CC BY-SA 4.0
|
||||||
|
|
||||||
|
if [ -f /dev/lp0 ]; then
|
||||||
dev="${PRINTER_DEV:-/dev/lp0}"
|
dev="${PRINTER_DEV:-/dev/lp0}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /dev/usb/lp0 ]; then
|
||||||
|
dev="${PRINTER_DEV:-/dev/usb/lp0}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ( ! -f /dev/lp0 ) && ( ! -f /dev/usb/lp0 )]; then
|
||||||
|
dev="${PRINTER_DEV:-/dev/stdout}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f "$infile" ]; then
|
if [ ! -f "$infile" ]; then
|
||||||
echo "txt2printr: file not found: $infile" >&2
|
echo "txt2printr: file not found: $infile" >&2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue