If you need to use !
(or your current
history character) for a command (for example, if you still use uucp or send mail to someone who does, using the
command-line mail (
Section 1.21) command), you can type a
backslash (\
) before each history character.
You can also drop into the Bourne or Korn shell quickly — assuming that you
aren't on a system that has replaced the real Bourne shell with a shell like
bash that has history substitution built
in. (If you're stuck, you can use the command set
+H
in bash;
this disables history substitution.) Either of these are probably easier than
changing histchars. For example:
%mail ora\!ishtar\!sally < file1
Quote the !s %sh
Start the Bourne shell $mail ora!ishtar!sally < file1
! not special here $exit
Quit the Bourne shell % And back to the C shell
The original Bourne shell doesn't have any kind of history substitution, so
!
doesn't mean anything special; it's
just a regular character.
By the way, if you have a window system, you can probably copy and paste the command line (Section 28.10) instead of using shell history.
— ML