printQueue 457 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. if [[ $(ls ~/prints/p* 2>/dev/null | wc -l) -eq 0 ]] ; then
  3. echo "No queued printjobs"
  4. exit
  5. fi
  6. if [[ ! -e ~/prints/default ]] ; then
  7. echo "~/prints/default does not exist" >&2
  8. exit
  9. fi
  10. for JOB in ~/prints/p* ; do
  11. FILE="${JOB}/$(cat "${JOB}/file")"
  12. OPTIONS=$(cat ~/prints/default)
  13. if [[ -e "${JOB}/options" ]] ; then
  14. OPTIONS=$(cat "${JOB}/options")
  15. fi
  16. lpremote ${FILE} ${OPTIONS}
  17. rm -r ${JOB}
  18. done