if [[ $# -gt 0 ]] ; then ERROR=0 # Has there been an error (0=no, 1=yes) LINE= # Line read from file LINE_COUNT=0 echo "file: $1" while [ $# -gt 0 ] do if [ ! -r "$1" ]; then echo "Cannot find file $1" 1>&2 ERROR=1 else LINE_COUNT=0 IFS= while read LINE do #echo "$LINE" (( LINE_COUNT++ )) STRING="$LINE" #_process_one_line echo "$1:$LINE_COUNT:$STRING" # reset the FIELD LIST LIST=$FULL_LIST ; # then go back and read more input if needed (next LINE) done <"$1" echo "File $1 has $LINE_COUNT lines" shift fi # reset the FIELD LIST LIST=$FULL_LIST ; # then go back and read more input if needed (next file) done shift exit $ERROR else while read LINE ; do # be sure every line has a ';' ending for this to work #cat ./Notes | while read LINE ; do #cat ./Notes | while read LINE ; do echo $LINE ; STRING=$LINE ; _process_one_line ; LIST=$FULL_LIST ; done STRING=$LINE ; _process_one_line ; # done with while read? # reset the FIELD LIST LIST=$FULL_LIST ; # then go back and read more input if needed done fi exit 0