Date: Mon, 9 Aug 2004 07:20:17 +0900 From: horio shoichi <bugsgrief@bugsgrief.net> To: "Hakim Z. Singhji" <hakim.singhji@earthlink.net> Cc: David Fleck <david.fleck@mchsi.com> Subject: Re: Help Debugging Kshell Script??? Message-ID: <20040808.222017.0044ba5c0a5e67e2.10.0.3.20@bugsgrief.net> In-Reply-To: <4116489D.2010905@earthlink.net> References: <411318A8.4080100@earthlink.net> <20040806161222.O275@grond.sourballs.org> <4115842C.2090907@earthlink.net> <20040808072043.S10021@grond.sourballs.org> <4116489D.2010905@earthlink.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 08 Aug 2004 11:37:01 -0400 "Hakim Z. Singhji" <hakim.singhji@earthlink.net> wrote: > do > # Use the bc utility in a here document to calculate the percentage of > # free and used swap space > > PERCENT_USED=$(bc <<EOF > scale=4 > ($SW_USED / $SW_TOTAL) * 100 > EOF > ) > > PERCENT_FREE=$(bc <<EOF > scale=4 > ($SW_FREE / $SW_TOTAL) * 100 > EOF > ) > ########################################################################## Which ksh are you running (/usr/local/bin/ksh{,93)) ? If you are really new to this sort of things, test them interactively with 'set -ux' options. horio shoichi BTW., it gave me a thing like this on 4.9-STABLE with /usr/local/bin/ksh. % ksh $ SW_USED=1 $ SW_TOTAL=3 $ PERCENT_USED=$(bc <<EOF > scale=4 > ($SW_USED / $SW_TOTAL) * 100 > EOF > ) $ echo $PERCENT_USED 33.3300 $ ^D %
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040808.222017.0044ba5c0a5e67e2.10.0.3.20>