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


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 11.4 My Favorite Is !:n* Chapter 11
The Lessons of History
Next: 11.6 Using !$ for Safety with Wildcards
 

11.5 My Favorite Is ^^

Well, maybe it's not my favorite, but it's probably the history substitution I use most often. It's especially handy if you have fumble-fingers on a strange keyboard:

% cat myflie


cat: myflie: No such file or directory
% ^li^il


cat myfile

Obviously, this doesn't save much typing for a short command, but it can sure be handy with a long one. I also use ^^ with :p (11.10 ) to recall an earlier command so I can change it. For example:

% !m:p


more gobbledygook.c
% ^k^k2


more gobbledygook2.c

The point is sometimes not to save typing, but to save the effort of remembering. For example, I want to print the file I looked at earlier, but don't remember the exact name...

[My keyboard can repeat characters when I'm not expecting it. I use a single ^ to delete extra characters. For example:

% lpr sources/aproggg.c


lpr: sources/aproggg.c: no such file or directory
% ^gg


lpr sources/aprog.c

You could type ^gg^ , but the second caret isn't required. With a single caret, you don't type a replacement string - just the string to delete. -JP]

- TOR


Previous: 11.4 My Favorite Is !:n* UNIX Power Tools Next: 11.6 Using !$ for Safety with Wildcards
11.4 My Favorite Is !:n* Book Index 11.6 Using !$ for Safety with Wildcards

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