Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: exclamation mark expansion in shell command



Bart,

On Wed, 2 Oct 2002, Bart Schaefer wrote:

> On Oct 2,  5:23pm, Heinrich Götzger wrote:
> }
> } I'm looking without success yet for a simple way to prevent zsh to expand
> } my cmd arguments (including !) to my history.
>
> There are several ways.
>
> First, history is not expanded for words in single quotes:
>
> zsh% echo '!foo'
> !foo
This works fine.

>
> Second, you can disable history expansion for a single command line by
> prefixing the line with !" like so:
>
> zsh% !" echo !foo
> !foo
>
> Note that in all versions of zsh less than 4.1.0, the "magic-space" key
> binding ignores the !" and still causes history to expand as you type.
> (In fact, it'll erase the !" as soon as you type the space after it.)

I'm using zsh 4.0.2 on Linux and if I type the line from the beginning,
the described behavior occures. But If I edit the command line in a way
that I add the !" at the beginning after typing the rest works as well.

> Finally, you can `setopt nobanghist' to turn off all history expansion.
This works very well as well.

Thanks again.

Heinrich



Messages sorted by: Reverse Date, Date, Thread, Author