> typeset -i memtotal=$(sed -ne 's/^MemTotal:[[:space:]]*\([0-9]*\)[[:space:]]*.*/\1/p' /proc/meminfo) Stop that. This is very dirty code. You are ignoring the unit, which will bite someone/somewhere sooner or later.