[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash's declare -p HISTIGNORE brings bash to a halt! Why?

From: Tim Friske
Subject: Re: Bash's declare -p HISTIGNORE brings bash to a halt! Why?
Date: Sun, 12 Jan 2014 02:48:40 +0100

Hi Chet,

apparently bash does not recognize the ":" colon characters in POSIX
character classes when assigned to the "HISTIGNORE" variable.

I tried to set the "HISTIGNORE" variable directly from within a
non-login, interactive session. But still I cannot convince bash's
history with the following definitions:

1.) HISTIGNORE="+([[:word:]])"

2.) HISTIGNORE="+([^[:space:]])"

On the other hand such simple definitions work:

1.) HISTIGNORE="+([a-z])"

2.) HISTIGNORE="+([-0-9A-Z_a-z])"

Best regards

2014/1/12 Tim Friske <address@hidden>:
> Hi Chet,
> hmm ... I simplified the pattern to "+([^[:space:]])". It works on
> when I let bash expand files but it does not keep bash from adding
> "word" commands such as "cd", "pwd", etc. My history related settings
> are as follows:
> shopt -s extglob
> declare -x HISTSIZE="10000"
> declare -x HISTFILESIZE="10000"
> declare -x histchars="!^#"
> declare -x HISTIGNORE="+([^[:space:]])"
> declare -x HISTCONTROL="ignorespace:ignoredups:erasedups"
> declare -x HISTTIMEFORMAT="%FT%T  "
> declare -x HISTFILE="/home/tifr/.cache/bash/history"
> Any ideas as to how to correctly assign the "+([^[:space:]])" pattern
> to the "HISTIGNORE" variable? By the way I'm setting the history
> related variables from my ".bash_login" file. That is why I'm
> exporting them.
> Thank you very much for your help.
> Kind regards
> Tim
> 2014/1/11 Tim Friske <address@hidden>:
>> Hi,
>> executing the following code in GNU bash, Version 4.2.45(1)-release
>> (x86_64-redhat-linux-gnu), Fedora 19 ...
>>     shopt -s extglob
>>     export 
>> HISTIGNORE="!(+(!([[\:space\:]]))+([[\:space\:]])+(!([[\:space\:]])))"
>>     declare -p HISTIGNORE
>> ... brings bash to a full stop. It does not print a command prompt
>> hereafter. Why is that.
>> Background:
>> All I want to tell bash is to ignore any simple, i.e. one word
>> command. Bash should not remember command lines like `cd`, `pwd`,
>> `history`, etc. My original definition of the `HISTIGNORE` variable
>> looked like this:
>>     export HISTIGNORE="!(+(!([[:space:]]))+([[:space:]])+(!([[:space:]])))"
>> I added a `\` backslash character before each `:` colon character
>> because according to the `bash` info pages the latter separates each
>> (extended) shell glob, i.e. pattern from another. Without escaping the
>> single pattern does not have any effect and a simple command still
>> makes it into history.
>> Cheers
>> Tim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]