[ -z "$MB" ] && MB=0
can be replaced by
: ${MB:=0}
Another solution is to use the following substition syntax when using your variable :
${MB:-0}
Parameter Substitution
${parameter}
The value, if any, of the parameter is substituted.
Braces are required only when parameter is followed by
a letter, digit, or underscore that is not to be
interpreted as part of its name. If parameter is * or
@, all positional parameters, starting with $1, are
substituted (separated by spaces). Parameter $0 is set
from argument zero when the shell is invoked.
${parameter:-word}
If parameter is set and is non-null, substitute its
value; otherwise substitute word.
${parameter:=word}
If parameter is not set or is null, set it to word; the
value of the parameter is then substituted. Positional
parameters cannot be assigned to in this way.
${parameter:?word}
If parameter is set and is non-null, substitute its
value; otherwise, print word and exit from the shell.
If word is omitted, the message ``parameter null or not
set'' is printed.
${parameter:+word}
If parameter is set and is non-null, substitute word;
otherwise substitute nothing.
Jean Pierre.