On Mon, Feb 24, 2014 at 11:10:44PM +0000, Fred wrote:
> On 02/24/14 22:32, Richard P??ttler wrote:
> >On Mon, Feb 24, 2014 at 10:59 PM, Fabian Raetz <fabian.ra...@gmail.com> 
> >wrote:
> >>while calculating my phys. memory (mb) with the
> >>folllowing shellsript i get as a result -424.
> >>
> >>sysctl -n hw.physmem returns 3849830400
> >>
> >>------------
> >>#!/bin/sh
> >>
> >>phys_mem_bytes=`sysctl -n hw.physmem`
> >>phys_mem_mb=`expr $phys_mem_bytes / 1024 / 1024`
> >>echo $phys_mem_mb
> >>----------
> >
> >You declared "#!/bin/sh" so you are using the broune shell, not ksh - fyi.
> >
> 
> On OpenBSD sh is the same binary as ksh, the notes section of the sh(1)
> gives some more detail as does the faq[1].
> 
> Fred
> 
> [1]http://www.openbsd.org/faq/faq10.html#ksh

#!/bin/sh

phys_mem_bytes=$(sysctl -n hw.physmem)
phys_mem_mb=$(($phys_mem_bytes / 1024 / 1024))
echo $phys_mem_mb
 

-- 
-=[rpe]=-

Reply via email to