home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 11.14 More Ways to Do Interactive History Editing Chapter 11
The Lessons of History
Next: 11.16 Instead of Changing History Characters
 

11.15 Changing C Shell History Characters with histchars

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.

- ML


Previous: 11.14 More Ways to Do Interactive History Editing UNIX Power Tools Next: 11.16 Instead of Changing History Characters
11.14 More Ways to Do Interactive History Editing Book Index 11.16 Instead of Changing History Characters

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System