zsh-users
 help / color / mirror / code / Atom feed
* exclamation mark expansion in shell command
@ 2002-10-02 15:23 Heinrich Götzger
  2002-10-02 15:32 ` DervishD
  2002-10-02 16:23 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Heinrich Götzger @ 2002-10-02 15:23 UTC (permalink / raw)
  To: zsh-users

Hi

I'm looking without success yet for a simple way to prevent zsh to expand
my cmd arguments (including !) to my history.

example:
'java Klass !1D200!1/C14objToRefresh_9'
will expand to some nasty string containing very old commands...
(I know, it's supposed to be that way, but I don't want it here)

How can I switch this off (temporarely)?

thanks

regards

Heinrich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exclamation mark expansion in shell command
  2002-10-02 15:23 exclamation mark expansion in shell command Heinrich Götzger
@ 2002-10-02 15:32 ` DervishD
  2002-10-02 16:23 ` Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: DervishD @ 2002-10-02 15:32 UTC (permalink / raw)
  To: Heinrich Götzger; +Cc: zsh-users

    Hi Heinrich :)

> 'java Klass !1D200!1/C14objToRefresh_9'
> will expand to some nasty string containing very old commands...
> (I know, it's supposed to be that way, but I don't want it here)
> How can I switch this off (temporarely)?

    java Klass '!1D....'. If you cannot use single quote, use double
quotes or no quotes and quote the '!' char individually (\!).

    Raúl


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exclamation mark expansion in shell command
  2002-10-02 15:23 exclamation mark expansion in shell command Heinrich Götzger
  2002-10-02 15:32 ` DervishD
@ 2002-10-02 16:23 ` Bart Schaefer
  2002-10-02 19:55   ` Heinrich Götzger
  2002-10-08  9:36   ` Heinrich Götzger
  1 sibling, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2002-10-02 16:23 UTC (permalink / raw)
  To: Heinrich Götzger, zsh-users

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

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.)

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   

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exclamation mark expansion in shell command
  2002-10-02 16:23 ` Bart Schaefer
@ 2002-10-02 19:55   ` Heinrich Götzger
  2002-10-08  9:36   ` Heinrich Götzger
  1 sibling, 0 replies; 6+ messages in thread
From: Heinrich Götzger @ 2002-10-02 19:55 UTC (permalink / raw)
  To: zsh-users

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
>
>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.)
>
>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.

I guess this hits the problem, I'll check on Monday in the office.
If it's not working, I'll provide more details.

Thanks a lot!

Heinrich

PS: I got every mail four times (2 times I understand, but 4 times is
enough for some cc on different places;-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exclamation mark expansion in shell command
  2002-10-02 16:23 ` Bart Schaefer
  2002-10-02 19:55   ` Heinrich Götzger
@ 2002-10-08  9:36   ` Heinrich Götzger
  2002-10-08 16:36     ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Heinrich Götzger @ 2002-10-08  9:36 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exclamation mark expansion in shell command
  2002-10-08  9:36   ` Heinrich Götzger
@ 2002-10-08 16:36     ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2002-10-08 16:36 UTC (permalink / raw)
  To: Heinrich Götzger; +Cc: zsh-users

On Oct 8, 11:36am, Heinrich Götzger wrote:
} 
} On Wed, 2 Oct 2002, Bart Schaefer wrote:
} 
} > 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.

Just to clarify ...

Yes, you can add the !" after the fact to avoid having it removed by
magic-space.  However, whether or not the !" is present, magic-space will
attempt to expand every history reference on the line if at any time you
type a space (and you're using the magic-space binding, obviously).

This has been fixed in 4.1.0-dev* so that magic-space recognizes when a
leading !" is present and does not expand history in that case.

-- 
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   

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-08 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 15:23 exclamation mark expansion in shell command Heinrich Götzger
2002-10-02 15:32 ` DervishD
2002-10-02 16:23 ` Bart Schaefer
2002-10-02 19:55   ` Heinrich Götzger
2002-10-08  9:36   ` Heinrich Götzger
2002-10-08 16:36     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).