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

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 11.5 My Favorite Is ^^ Chapter 11
The Lessons of History
Next: 11.7 History Substitutions
 

11.6 Using !$ for Safety with Wildcards

We all know about using ls before a wildcarded rm to make sure that we're only deleting what we want. But that doesn't really solve the problem: you can type ls a* and then mistakenly type rm s* with bad consequences - it's just a minor slip of your finger. But what will always work, if you're a csh or bash user, is:

% 

ls a*


a1 a2 a3
% 

rm !$

( ls -d a* ( 16.8 ) will make less output if any subdirectory names match the wildcard.)

Using the history mechanism to grab the previous command's arguments is a good way to prevent mistakes.

- ML


Previous: 11.5 My Favorite Is ^^ UNIX Power Tools Next: 11.7 History Substitutions
11.5 My Favorite Is ^^ Book Index 11.7 History Substitutions

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










??????????????@Mail.ru