Don't add current command to history (ignore
flag)
#22
-
What do you want?Running a command without it being added to the history in the first place (sort of, it shall be added, but removed instantly). This would be great, as it would allow to send a single command in incognito without the necessity to send a Why do you want this?I have so send a secret to my Android phone via USB debugging ( Who else would benefit from this?Anybody who wants to send a single command and delete it from history in one go, i.e. when having the command on the password manager like I do. Right now, sending How should it work?Given this situation: When I perform these steps: Then I expect this to happen: Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
That's already possible in Zsh natively. You have three options for this, all of which can be combined:
|
Beta Was this translation helpful? Give feedback.
-
@marlonrichert Thank you for the detailed explanation, it makes sense to do it this way. Very useful. |
Beta Was this translation helpful? Give feedback.
That's already possible in Zsh natively. You have three options for this, all of which can be combined:
setopt HIST_IGNORE_SPACE
to your.zshrc
file. Then, if you insert at least one space at the very beginning of a command line, it will not be saved to history, although it is still saved to local history in memory.HISTORY_IGNORE=<glob pattern
to your.zshrc
file. Then, any command line that matches that pattern will not be saved to history..zshrc
file: