Ah. Thanks! I switched to ksh and problem solved. Otoh, this tool gave me a slightly larger kernel than the old adjustkernel (5.4 vs. 4.9 mb).
Hmmm... Very strange. But any way I need to compare output from my script and adjustkernel. Also, may be better use /var/run/dmesg.boot instead dmesg(8). Well, I try to fix this later... :)