diff options
author | EuAndreh <eu@euandre.org> | 2025-08-06 15:28:39 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-08-06 15:28:39 -0300 |
commit | f6355af737ca338e82cdf65a564e6cf7e01477d6 (patch) | |
tree | f296fa09939a6f0ccbc533be9f1e96f97d41845c | |
parent | etc/sh/rc: Add $POSIXLY_CORRECT (diff) | |
download | dotfiles-f6355af737ca338e82cdf65a564e6cf7e01477d6.tar.gz dotfiles-f6355af737ca338e82cdf65a564e6cf7e01477d6.tar.xz |
bin/print: Use $OPTS over lpotions(1) that modifies ~/.cups
-rwxr-xr-x | bin/print | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -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 |