#!/bin/bash # # Syntax: lpl [-h] # # Purpose: Prints the most recently changed file in the # current directory. # The -h flag shows the help info for this command. # Created: Aug 25, 2002 by Bart De Schutter # Last revised: Feb 10, 2005 by Bart De Schutter # # See http://www.deschutter.info/util/scripts.html for the latest version of # this script. # Status: public # Category: printing 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 lp_file=$((ls -t * | head -n 1) 2>/dev/null) if [ -n "$lp_file" ]; then echo "Printing $lp_file" lp "$lp_file" else echo "No files found." fi