#!/bin/bash
#trap1
trap "my_exit" 2
LOOP=0
my_exit()
{
echo -n "you just hit ,at number $LOOP"
echo "I will now exit"
exit 1
}
while :
do
LOOP=`expr $LOOP + 1`
echo $LOOP
done
for((i=0;i<9;i++))
do
a=$i$a
echo $a
done
LOOP=0
TOTAL=0
COUNT=0
echo "23 45"
echo "========="
while read DEPT ITEMS
do
COUNT=`expr $COUNT + 1`
if [ "$DEPT" = "GIFT" ];
then
TOTAL=`expr $TOTAL + $ITEMS`
ITEMS=`expr $ITEMS + 1`
echo -e "$ITEMS\t$DEPT"
fi
done < /home/total.txt
echo "=============="
echo $TOTAL
echo "there are $COUNT"
阅读(952) | 评论(0) | 转发(0) |