The command
CD -
will change the pwd to the last directory.
Is there a way to know which directory it is, so that I'll know where I am CD'ing to?
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
Yes, it is $OLDPWD.
| |||||||
feedback
|
|
You can also use ~- (anywhere you can use tilde expansion) instead of $OLDPWD:
There is also ~+ for $PWD, which is useful for commands which require an absolute directory:
Note that things like | |||
|
feedback
|