diff --git a/src/shared/shell.c b/src/shared/shell.c
index cfdcc76..2e094b8 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
static void rl_handler(char *input)
{
wordexp_t w;
+ HIST_ENTRY *last;
if (!input) {
rl_insert_text("quit");
if (!bt_shell_release_prompt(input))
goto done;
- if (history_search(input, -1))
+ last = history_get(history_length + history_base - 1);
+ /* append only if input is different from previous command */
+ if (!last || strcmp(input, last->line))
add_history(input);
if (data.monitor)