Re: 64-bit arithmetic in scripts?
From: Dan Nelson (dnelson_at_allantgroup.com)
Date: 09/30/04
- Previous message: Garance A Drosihn: "Re: FreeBSD compilation"
- In reply to: Andrew: "64-bit arithmetic in scripts?"
- Next in thread: Andrew: "Re: 64-bit arithmetic in scripts?"
- Reply: Andrew: "Re: 64-bit arithmetic in scripts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 14:40:01 -0500 To: Andrew <infofarmer@mail.ru>
In the last episode (Sep 30), Andrew said:
> I'm counting traffic with ipfw and shell scripts. Is there a way to
> use more than 32-bit numbers in shell arithmetic?
POSIX only requires "signed long" support in the shell, but FreeBSD's
expr command has a -e flag that will let it do 64-bit math:
$ echo $(( 65536*65536 ))
0
$ echo $(expr 65536 "*" 65536)
0
$ echo $(expr -e 65536 "*" 65536)
4294967296
bash, ksh93 (but not pdksh), and zsh's shell arithmetic are all 64-bit,
also.
-- Dan Nelson dnelson@allantgroup.com _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
- Previous message: Garance A Drosihn: "Re: FreeBSD compilation"
- In reply to: Andrew: "64-bit arithmetic in scripts?"
- Next in thread: Andrew: "Re: 64-bit arithmetic in scripts?"
- Reply: Andrew: "Re: 64-bit arithmetic in scripts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|