The existence of special characters (particularly
!
) can be a pain; you may often need to type commands that have exclamation points in them, and occasionally need commands with carets (
^
). These get the C shell confused unless you "quote" them properly. If you use these special characters often, you can choose different ones by setting the
histchars
variable.
histchars
is a two-character string; the first character replaces the exclamation point (the "history" character), and the second character replaces the caret (the
"modification" character (
11.5
)
). For example:
%set histchars='@#'
%ls file*
file1 file2 file3 %@@
Repeat previous command (was!!
) ls file* file1 file2 file3 %#file#data#
Edit previous command (was^file^data^
) ls data* data4 data5
An obvious point: you can set
histchars
to any characters you like, but it's a good idea to choose characters that you aren't likely to use often on command lines. Two good choices might be
#
(hash mark) and
,
(comma). [2]
[2] In the C shell,
#
is a comment character ( 44.2 ) only in non-interactive shells. Using it as a history character doesn't conflict because history isn't enabled in non-interactive shells.
-