Only commands with exit status != `NO_SUCH_COMMAND` are saved in history?
Created by: BafDyce
Reproduction: enter a command which is not found, e.g. gerp -rn "some_complex_regex" .
; note the typo in grep
Expected behavior: Even though the command was not found, it's invocation attempt should be stored in the history, so that one can press arrow up
, fix the mistake, and rerun the command.
# echo hi
hi
# gerp -rn "some_complex_regex" .
ion: command not found: gerp
# history | tail -1
gerp -rn "some_complex_regex" .
Actual behavior:
# echo hi
hi
# gerp -rn "some_complex_regex" .
ion: command not found: gerp
# history | tail -1
echo hi
Build information:
# rustc -V
rustc 1.19.0 (0ade33941 2017-07-17)
# git rev-parse HEAD
5bbc65d55f1eb75e89eb5141d51b57d0eecd91c8
# uname -a
Linux <hostname> 4.12.6-1-ARCH #1 SMP PREEMPT Sat Aug 12 09:16:22 CEST 2017 x86_64 GNU/Linux
Misc:
I understand that the current behavior might be desired for some people and it probably is a sane default. However, if the command was rather complex/long its a pain to a) retype or b) copy & paste it with the mouse.
Maybe, it would be possible to add an environment variable to modify this behavior? What would be a good name for that variable? HISTORY_IGNORE
maybe?
If the above does not fit the nature of the issue feel free to modify it.