[Chapter 14] 14.12 Marking Your Place with a Shell Variable
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:37:12Z

#

| Chapter 14 Moving Around in a Hurry |

## 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

14.11 Finding (Anyone's) Home Directory, Quickly |  | 14.13 Which Directory Am I in, Really?