> -----------------------------------------------
> #!/bin/sh
>
> FNAME=$(echo $1 | sed -r 's;.*/([^/]+);\1;')
> RFNAME=$(readlink -f $1)
>
> mupdf $1 &
> echo $RFNAME > /tmp/${FNAME}_pmupdf
> #!/bin/sh
>
> FWIN=$(xdotool getwindowfocus)
> FNAME=$(echo $(xdotool getwindowname $FWIN) | sed -r 's/pdf.*/pdf/')
> export RFNAME=$(cat /tmp/${FNAME}_pmupdf)
>
> # CUPS's lp
> xterm -e sh -c 'echo Range of pages?; read PAGES; lp -P $PAGES $RFNAME'
-----------------------------------------------
Please, don't copy-paste these scripts, they are examples written fast in
a email. Indeed, sed -r 's/pdf.*/pdf/' will cat the file name if it contains
"pdf".
Better use
sed -r 's; - [1-9]+/[1-9].*;;'