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

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 14.11 Finding (Anyone's) Home Directory, Quickly Chapter 14
Moving Around in a Hurry
Next: 14.13 Which Directory Am I in, Really?
 

14.12 Marking Your Place with a Shell Variable

The following alias will store the current directory name in a variable:

alias mark 'set \!:1=$cwd'

so as to use a feature of the C shell:

% 

mark 



here


   ...
% 

cd 



here

One need not even type $ here . If a directory does not exist, csh tries searching its cdpath ( 14.5 ) , then tries evaluating the name as a variable ( 6.8 , 6.9 ) .

(I generally use pushd and popd ( 14.6 ) to store directory names; mark is more useful with commands that need to look in two different paths, and there $ here is necessary anyway. Ah well.)

[In bash , you can do this by setting the cdable_vars variable. (Put cdable_vars=1 in your shell setup file ( 2.2 ) .) - JP ]

- CT in comp.unix.wizards on Usenet, 14 February 1987


Previous: 14.11 Finding (Anyone's) Home Directory, Quickly UNIX Power Tools Next: 14.13 Which Directory Am I in, Really?
14.11 Finding (Anyone's) Home Directory, Quickly Book Index 14.13 Which Directory Am I in, Really?

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