doshell: ensure new_command[] is initialized.

It's unclear if it would happen in practice, but clang thinks there
is a chance that new_command[] could be used uninitialized in a
comparison, so this patch initializes new_command[]. It also adds
a check to ensure j is valid (>0) when doing new_command[j-1].