diff --git a/apps/src/sh.c b/apps/src/sh.c index 8e2f5f5a..c9904e76 100644 --- a/apps/src/sh.c +++ b/apps/src/sh.c @@ -139,11 +139,33 @@ void command_concat(command* cmd, const char* str) { while (*str) { - putchar(*str); - if (*str == '\b') { command_pop(cmd); } - else if (*str == '\n') { command_execute(cmd); } + if (*str == '\b') + { + if (cmd->size == 0) + { + str++; + continue; + } + putchar(*str); + command_pop(cmd); + } + else if (*str == '\n') + { + if (cmd->size == 0) + { + putchar(*str); + show_prompt(); + str++; + continue; + } + putchar(*str); + command_execute(cmd); + } else + { + putchar(*str); command_push(cmd, *str); + } str++; } }