Emanuele Torre <[email protected]> writes:
> ! followed by a ; or another terminator is interpreted as an history
> expansion with no pattern that can never match anything.
>
> $ !; echo hi
> bash: !: event not found
> $ !&& echo hi
> bash: !: event not found
IMHO it is more to the point that in the manual page it says
!string
Refer to the most recent command preceding the current position
in the history list starting with string.
without defining "string".
It looks like the actual definition is "everything from the ! to the end
of the word", taking into account
The line is broken into words
in the same fashion as when reading input, so that several metacharacâ
ter-separated words surrounded by quotes are considered one word. Hisâ
tory expansions are introduced by the appearance of the history expanâ
sion character, which is ! by default.
With the significant detail that the ! need not be the first character
of the word.
So I think the manual page could be improved by adding *...*:
!string
Refer to the most recent command preceding the current position
in the history list starting with string. *All characters
until the start of the word designator or end of the word
are part of string.*
The line is broken into words
in the same fashion as when reading input, so that several metacharacâ
ter-separated words surrounded by quotes are considered one word. Hisâ
tory expansions are introduced by the appearance of the history expanâ
sion character, which is ! by default*, within a word*.
Dale