warbo-utilities: cabd0725546fafbfa036422f9b54f199bd26ca53

     1: #!/usr/bin/env bash
     2: set -e
     3: 
     4: # Open all useful PDFs
     5: 
     6: function isOpen {
     7:     # shellcheck disable=SC2009
     8:     ps auxww | grep mupdf-x11 | grep -q "$1"
     9: }
    10: 
    11: function openIfNeeded {
    12:     # Open $2 if it's not already (i.e. if `mupdf-x11 ... $1` appears in `ps`)
    13:     if isOpen "$1"
    14:     then
    15:         echo "Already have reader for $2, skipping" 1>&2
    16:     else
    17:         echo "Opening $2" 1>&2
    18:         mupdf-x11 "$2" &
    19:     fi
    20: }
    21: 
    22: while read -r LINE
    23: do
    24:     # Skip comments
    25:     echo "$LINE" | grep -q '^\s*#' && continue
    26:     UNIQUEID=$(echo "$LINE" | cut -f1)
    27:     LOCATION=$(echo "$LINE" | cut -f2)
    28:     openIfNeeded "$UNIQUEID" "$LOCATION"
    29: done < ~/.pdfs

Generated by git2html.