#!/bin/sh
# 10 MB
MAX_SIZE_BYTES=10000000
# we want ONE command line argument
if [ $# -ne 1 ]
then
echo "Usage: $0 DIRECTORY" >&2
exit 2
fi
die()
{
echo "$1" >&2
exit 1
}
DIRECTORY=$1
[ -d "$DIRECTORY" ] || die "This is not a valid directory: $DIRECTORY"
# create a list of files we want
THE_FILES=$( find "$DIRECTORY" -type f -size -${MAX_SIZE_BYTES}c -regex ".*/expense[0-9]+\.xyz" )
# do something with the files
echo "$THE_FILES"
shell is lovely, isn't it? (edited)./config_retrieve maps/*.map