On 07/27/2006 02:51:15 PM, Peter wrote:
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

+ expr 0.000 + 0.000
expr: non-numeric argument

I've not tried to scroodle what you're trying to do,
but expr is integer-only.  That's your problem.

When faced with problems that look like this I usually
use awk with a awk script on the command line
mixed in with the regular shell scripting.
Mostly because it's not perl so there's
an upper limit to how crazy the script can get.

Regards,

Karl <[EMAIL PROTECTED]>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein

Reply via email to