#!/bin/bash # # Syntax: gvl # # Purpose: Shows the most recently changed .ps or .eps file in the # current directory. # The -h flag shows the help info for this command. # # See also: gv # Created: Aug 19, 1998 by Bart De Schutter # Last revised: Jul 4, 2016 by Bart De Schutter # # See http://www.deschutter.info/util/scripts.html for the latest version of # this script. # Status: public # Category: postscript, latex if [ $# -ge 1 -a "$1" = "-h" ]; then sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1 fi if [ $# -ne 0 ]; then echo >&2 echo >&2 "ERROR: ${0##*/} requires no input arguments." echo >&2 sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1 fi psfile=$((ls -t *.ps *.eps | head -n 1) 2>/dev/null) GV_COMMAND=$(type -p /usr/bin/gv) if [ -z "$GV_COMMAND" ] then GV_COMMAND=$(type -p kghostview) if [ -z "$GV_COMMAND" ] then GV_COMMAND=$(type -p gsview) if [ -z "$GV_COMMAND" ] then GV_COMMAND=$(type -p ghostview) if [ -z "$GV_COMMAND" ] then GV_COMMAND=$(type -p okular) if [ -z "$GV_COMMAND" ] then echo >&2 echo >&2 "ERROR: No ps viewer found on this system." echo >&2 exit 1 fi fi fi fi fi if [ -n "$psfile" ]; then $GV_COMMAND "$psfile" & else echo "No .ps or .eps files found." fi