diff --git a/builtins/fc.def b/builtins/fc.def index 6951a687..ba7c47bf 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -354,8 +354,10 @@ fc_builtin (list) } /* "When not listing, the fc command that caused the editing shall not be - entered into the history list." */ - if (listing == 0 && hist_last_line_added) + entered into the history list." However, if the user passed "-0", then + histend will have been set to real_last above. This means the user wants + to include the current command, so we do not remove it here. */ + if (listing == 0 && hist_last_line_added && histend < real_last) { bash_delete_last_history (); /* If we're editing a single command -- the last command in the