Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: do not write certain commands to history file
- X-seq: zsh-users 15330
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: do not write certain commands to history file
- Date: Wed, 25 Aug 2010 23:01:08 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=17UOqExvARWOknlGsb5VZWRETCn8cDzqLeMNEpFY4OM=; b=EfgGYAbWgBYrF67eCtVEskDXSkoH7vW2Rn2ppNpeRBTJip/0cfFQU9X9og5fmp6Pb1 hyfsocx/LtS4Z0btawYuS9w/ihMz5U3zzleleOJXGVexdCdQ06QVDReWOWZVA3Vs0z1n XJmWWJ59XZGerqGvYBAdE5sbb2/RV0rxeBb3I=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=s1EG7kb+Erh45iY1CUHFVpHdeILVhGxYASefGdd6qGHhOvvYi/q7oRmJ9/LL9H5AhG BtcQdLpnmBg6g+VuqgynTHYG4fWC21oCj84Cxd54bXvXLiReRIe9fzX+jcXhUiiuwXlO r2IvPHE+L6XqdojL1bx0uxFpU7V3S9Lsdak5w=
- In-reply-to: <alpine.LNX.2.01.1008251647000.4535@hp>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100825192608.GG11622@xxxxxxxxxxxxx> <AANLkTimkMhrSeX6VpDBbMxO-VdMOr4n-0qsF==xBPjNd@xxxxxxxxxxxxxx> <mailbox-6437-1282767733-460593@pepper> <alpine.LNX.2.01.1008251647000.4535@hp>
On 25 August 2010 22:55, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:
> On Wed, 25 Aug 2010, Eric Smith wrote:
>
>> Thanks Mikael. If it is not in the buffer I do not care. But I cannot
>> work your example.
>>
>> Found this below in a config file somewhere and thought I could adapt
>> it. I want to exclude all commands that have "foobar" anywhere in
>> them, as the command or in the arg list. Quick hack did not work.
>> All lines are still written to the history file.
>>
>> zshaddhistory() {
>> local line=${1%%$'\n'}
>> local cmd=${line%% *}
>>
>> [[ ${#line} -ge 5
>> && ${cmd} != "rm"
>> && ${cmd} != (l|l[sal])
>> && ${cmd} != (c|cd)
>> && ${cmd} != (m|man)
>> && ${arg} != (*foobar*)
>> ]]
>> }
>
> Where are you setting $arg? Do you mean $line? or are you trying to
> match *foobar* in $argv?
>
> If the latter, you can't just match an array against a pattern (since
> there's no sensible default for whether it's conjunctive or disjunctive
> [any or all]). I'm not sure of the [[ ]] form offhand, but the (( ))
> form would be:
>
> [[ # what you already have ]] && (( ! $argv[(I)*foobar*] ))
What are you talking about? There's no $arg anywhere, and no arrays.
zshaddhistory() is passed the entire command line in a single
argument.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author