bug-bash
[Top][All Lists]
Advanced

[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: Chet Ramey
Subject: Re: Bash's declare -p HISTIGNORE brings bash to a halt! Why?
Date: Sat, 11 Jan 2014 19:11:55 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 1/11/14, 5:54 PM, Tim Friske wrote:
> 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.

The matcher blows up and goes exponential when the backslashes are in
there.  I didn't investigate why.

> 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.

You don't need the backslashes; the colons are part of the patterns.  The
ignore pattern parser understands pattern syntax, so the colons in the
bracket expressions don't split the value.

The HISTIGNORE value without the backslashes seems to work using
bash-4.2.45: single-word simple commands are not added to the history list.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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