# get_rec
clear
echo -n "Enter the employee surname to view or all for all records:"
read STR
if [ "$STR"="q" ] ; then
return 1 fi
if [ "$STR"="all" ]; then # просмотр всех записей
echo "Surname Name Employee Code" echo"____________________________________"
cat $DBFILE |awk -F: '{print $2"\t"$3"\t\t"$1}' | more
return 0
fi
REC=0
MATCH=no
if [ "$STR" != "" ]; then
while read CODE F_NAME S_NAME DEPART
do
REC=`expr $REC + 1`
tput cup 3 4
echo -n " searching record.. $REC" if [ "$S_NAME"="$STR" ]; then
# обнаружено имя
MATCH=yes
display_rec
break
else
continue
fi
done <$DBFILE
else
echo "Enter a surname to search for or q to quit"
fi