Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Preventing a single command from being saved in history
- X-seq: zsh-users 13869
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Preventing a single command from being saved in history
- Date: Wed, 18 Feb 2009 11:31:06 -0500 (EST)
- In-reply-to: <b2e43f8f0902180819x4955a281r6ae8700e4dbcc5a6@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <b2e43f8f0902180819x4955a281r6ae8700e4dbcc5a6@xxxxxxxxxxxxxx>
On Wed, 18 Feb 2009, Allan Caffee wrote:
Is there a way to prevent an arbitrary command line from being stored in
the shell history (for any longer than one command)? A use of this for
example might be if I were to set a password into the environment or
pass some sensitive information to a program on the command line.
If this functionality does not currently exist how difficult would it be
to provide a precommand modifier? I know the internals for this kind of
manipulation are already in place for options like HistNoStore and
HistNoFunctions. I've only glanced over the source code but it seems
like all that would be needed is to have should_ignore_line return 1 if
the precommand modifier is in effect.
I assume you're looking for histignorespace (hist_ignore_space if you're
rooting through man pages)? Then any command that starts with a space (or
any alias that expands as such) is ignored.
The 'alias' thing is useful, for example, to hide some things I don't
really care to have in history:
alias fg=' builtin fg'
alias bg=' builtin bg'
alias rehash=' builtin rehash'
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author