Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 14.6 The Shells' pushd and popd Commands Chapter 14
Moving Around in a Hurry
Next: 14.8 Quick cds with Aliases
 

14.7 Nice Aliases for pushd

The pushd command (14.6) is nice for jumping around the filesystem. But some of the commands you might type a lot, like pushd +4, are sort of a pain to type. I saw these aliases (10.2) in Daniel Gilly's setup file. They looked so handy that I decided to steal them for this book. There are C shell versions in the first column and bash in the second:

alias pd pushd                 alias pd=pushd
alias pd2 'pushd +2'           alias pd2='pushd +2'
alias pd3 'pushd +3'           alias pd3='pushd +3'
alias pd4 'pushd +4'           alias pd4='pushd +4'

So, for example, to swap the fourth directory on the stack, just type pd4.

- JP


Previous: 14.6 The Shells' pushd and popd Commands UNIX Power ToolsNext: 14.8 Quick cds with Aliases
14.6 The Shells' pushd and popd Commands Book Index14.8 Quick cds with Aliases

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