added more options for printers - if none fount it should output to stdout

master
Amir Alexander Abdelbaki 2026-07-14 08:57:56 +02:00
parent e295910234
commit c89e1e01ac
2 changed files with 18 additions and 1 deletions

View File

@ -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}"
dev="${PRINTER_DEV:-/dev/lp0}" # 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}"
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

0
v Normal file
View File