!find command lets the user perform the previously executed
find, with all its parameters.
How does it work internally, where exactly has this behaviour been programmed?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
It's not related to the
find command itself, it's a feature of the shell called history expansion. If your shell supports history expansion, you can refer to a past command you typed and do some things with it.
For example in Bash, your action refers to a command from history by an event designator. From the Bash manual:
An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.
Start a history substitution, except when followed by a space, tab, the end of the line,
extglobshell option is enabled using the
Refer to the most recent command preceding the current position in the history list starting with string.
For the real internals you can read the source code of
get_history_event from Bash 4.3.