#!/bin/sh echo "the input was $1" if [ -z $1 ]; then echo "-z says there is no input 1=$1" fn="lastline.dat" else fn=$1 fi echo "Output name is $fn" sed 1q DataCulture1 > $fn for x in D* do tail -n 1 $x >> $fn done exit 0