#!/bin/bash set -x MAPDIR=/home/akligman/tmp/df # figure out which map is the newest. NEWEST=`ls -tr ${MAPDIR}/local_map-1-* | tail -1` # remove all the maps that aren't the newest MAPS=( `echo ${MAPDIR}/local_map-1-*` ) for M in ${MAPS}; do if [ ${M} != ${NEWEST} ]; then echo removing ${M} # uncomment to actually remove the map # rm ${M} fi done # display the newest map gthumb ${NEWEST}