I am writing a shell script to handle simple IP accounting and I'm
getting an error I cannot solve.  Here is the pertinent snippet:

PORT_IN=$(pfctl -sl | grep $i | grep $LABEL | cut -d ' ' -f 9)    #
bytes
PORT_IN=$(echo "scale=3; $PORT_IN / 1024" | bc)               #
kilobytes
PORT_IN_SUM=$(cat $IN_DIR/$LABEL)                                 #
current value
PORT_IN_SUM=$(expr $PORT_IN_SUM + $PORT_IN)              # add new
value
echo $PORT_IN_SUM > $IN_DIR/$LABEL                               # send
back to file


Troubleshooting:

+ read LABEL
+ pfctl -sl
+ grep outbound
+ grep tcp:11371
+ cut -d   -f 9
+ PORT_IN=0
+ echo scale=3; 0 / 1024
+ bc
+ PORT_IN=0.000
+ cat /var/ip_accnt/2006/July/bytes_in/tcp:11371
+ PORT_IN_SUM=0.000
+ expr 0.000 + 0.000
expr: non-numeric argument
+ PORT_IN_SUM=
+ echo
+ > /var/ip_accnt/2006/July/bytes_in/tcp:11371

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to