Are compound command's second and subsequent lines not effected by HISTCONTROL in bash?

Posted by UniMouS on Stack Overflow See other posts from Stack Overflow or by UniMouS
Published on 2012-11-04T00:45:17Z Indexed on 2012/11/04 11:01 UTC
Read the original article Hit count: 158

Filed under:
|

When consulting bash's man page, it read this sentence about bash history:

The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTCONTROL.

But I have tried this:

$ HISTCONTROL=ignorespace
$  if [ -f /var/log/messages ]
> then
> echo "/var/log/message exists."
> fi
$ history | tail -2
   18  HISTCONTROL=ignorespace
   19  history | tail -2

Note that the if is leaded by a space. Why the second line of this if compound command still not appear in the history?

© Stack Overflow or respective owner

Related posts about linux

Related posts about bash