-- work overload --
#!/bin/shn=0sum=0while read xdo sum=`echo $sum + $x | bc` if [ "$?" -eq "0" ]; then n=`expr $n + 1` fidoneecho "scale=2;$sum/$n"| bc
Good for people to know.
Other than removing the "-p" for read, and the comments, what does this fix that wasn't in the linked page?
changed sum=`expr $sum + $x` to sum=`echo $sum + $x | bc` so it can deal with large and floating point numbers. I added a comment about this in your blog a long time ago.
[Due to much spam, comments are now moderated and will be posted after review]
Note: Only a member of this blog may post a comment.
Good for people to know.
ReplyDeleteOther than removing the "-p" for read, and the comments, what does this fix that wasn't in the linked page?
ReplyDeletechanged sum=`expr $sum + $x` to sum=`echo $sum + $x | bc` so it can deal with large and floating point numbers. I added a comment about this in your blog a long time ago.
ReplyDelete