From f6355af737ca338e82cdf65a564e6cf7e01477d6 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 6 Aug 2025 15:28:39 -0300 Subject: bin/print: Use $OPTS over lpotions(1) that modifies ~/.cups --- bin/print | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/bin/print b/bin/print index 5aef102..4f41272 100755 --- a/bin/print +++ b/bin/print @@ -63,13 +63,13 @@ main() { cd "$NEWDIR" if [ -z "$DUPLEX" ]; then - lp in.pdf + lp $OPTS in.pdf cd - > /dev/null return fi if [ "$(n_pages in.pdf)" = '1' ]; then - lp in.pdf + lp $OPTS in.pdf return fi @@ -80,10 +80,10 @@ main() { NEVEN="$(n_pages even.pdf)" printf 'Printing odd pages...\n' >&2 - lp odd.pdf + lp $OPTS odd.pdf printf 'Has printing finished yet? Once it does, reload the pages and hit it enter to continue. ' read -r < /dev/tty - lp even.pdf + lp $OPTS even.pdf if [ "$NODD" != "$NEVEN" ]; then printf '\n' | lp @@ -107,24 +107,23 @@ for flag in "$@"; do esac done -QUALITY_SET=false DUPLEX= +OPTS='-o PrintQuality=standard' while getopts 'dq:h' flag; do case "$flag" in (d) DUPLEX=1 ;; (q) - QUALITY_SET=true case "$OPTARG" in low) - lpoptions -o PrintQuality=draft + OPTS='-o PrintQuality=draft' ;; medium) - lpoptions -o PrintQuality=standard + OPTS='-o PrintQuality=standard' ;; high) - lpoptions -o PrintQuality=high + OPTS='-o PrintQuality=high' ;; *) echo "Bad QUALITY option: \"$OPTARG\"" >&2 @@ -145,10 +144,6 @@ while getopts 'dq:h' flag; do done shift $((OPTIND - 1)) -if [ "$QUALITY_SET" = false ]; then - lpoptions -o PrintQuality=standard -fi - NEWDIR="$(mkdtemp)" trap 'rm -rf "$NEWDIR"' EXIT if [ -z "${1:-}" ]; then -- cgit v1.2.3