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

Re: exclamation mark expansion in shell command

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'

Second, you can disable history expansion for a single command line by
prefixing the line with !" like so:

zsh% !" echo !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.)

Finally, you can `setopt nobanghist' to turn off all history expansion.

If none of those seems to cover your situation, you'll have to explain in
more detail.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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