#!/bin/bash # # Syntax: acro [-h] [pdf_file [...]] # # Purpose: Starts acroread. If no input arguments are given, the most # recently changed .pdf file in the current directory is opened. # The -h flag shows the help info for this command. # Created: Jan 19, 2000 by Bart De Schutter # Last revised: Jun 23, 2014 by Bart De Schutter # # See http://www.deschutter.info/util/scripts.html for the latest version of # this script. # Status: public # Category: pdf shopt -q -s expand_aliases # OK, necessary in case acroread is an alias. if [ $# -ge 1 -a "$1" = "-h" ]; then sed '/^$/q;/^#!/d;s/^# //;s/^#//' $0 >&2 exit 1 fi if [ $# -eq 0 ]; then pdffile=$((ls -t *.pdf | head -n 1) 2>/dev/null) if [ -n "$pdffile" ]; then okular "$pdffile" & else okular & fi else okular "$@" & fi