View difference between Paste ID: 8CeACHFP and 5HjXjrfV
SHOW: | | - or go back to the newest paste.
1
#!/bin/bash
2
typeset -i total=0
3
#typeset -i LINE
4
LINE=0
5
6
7
while read operator LINE ; do
8
echo $operator ::: $LINE
9-
#echo $LINE | tr -d '[:alpha:]' | read param2
9+
10
echo $param2, ${#param2} 
11
12
if [[ ${#param2} -eq 0 ]] ; then
13
	echo $0: error
14
	exit 3
15
else	
16
	if [ $operator='+' ] ; then
17
		echo '+'  $operator
18
		total=total+$param2
19
		echo $total
20
	elif [ $operator='-' ] ; then
21
		echo $operator 
22
		total=total-$param2
23
		echo $total
24
	else 
25
		echo error
26
		exit 2
27
	fi
28
fi ; done
29
30
echo total: $total
31
exit 0