How not to produce a file list

How To Make A File List - the normal way

files=`ls /data/dumps/*.dmp* | sort`

How To Make A File List - a more interesting way

This is authentic code, cut from the backup script of a commercial software package. Read it and weep.

# Find all files to write to tape
rm -f /tmp/files1
# dump-directory
find /data/dumps -name "*.dmp*" -print >> /tmp/files1
# make sure files are only backed up once
sort /tmp/files1 | grep -v '^ *$' > /tmp/files2
uniq /tmp/files2 /tmp/files3
echo dummy >/dev/null 2>/tmp/files9  # creates empty file
while [ `wc -l /tmp/files3 | awk '{print $1}'` -gt 0 ]
  filename=`line < /tmp/files3`
  echo $filename >> /tmp/files9
  grep -v "^$filename$" /tmp/files3 > /tmp/files4
  grep -v "^$filename/" /tmp/files4 > /tmp/files5
  mv /tmp/files5 /tmp/files3
cat <<EOI > /tmp/awkscript
{filelist = filelist " " \$0}
END {print filelist}
files=`awk -f /tmp/awkscript /tmp/files9`