Reputation: 2032
Recently, I accidentally typed !{0}
. I think it is some kind of special zsh function because it showed one of my previous commands while I execute it.
What does it mean on zsh?
$ !{0}
Note: I'm using zsh on Ubuntu.
Upvotes: 0
Views: 330
Reputation: 241731
If you're "using zsh
on ubuntu" then you are not using bash
. bash
and zsh
are two different shells, which have slightly different behaviours.
In both shells, !
introduces a history expansion, which replaces the !
and following word with something taken from the command history.
In zsh
, !{0}
will be replaced with the previous command you typed which started with 0; the same as !0
. In bash, the braces are treated literally, so !{0}
will be replaced with the previous command which started with {0}. In both shells, !1
will be replaced with the first command in the history (if it is still remembered); in zsh
, !{1}
will also be replaced with the first command in the history, while in bash
it will be replaced by a command starting with {1}
Upvotes: 3